{"name":"@percy/logger","version":"1.31.4","license":"MIT","_id":"@percy/logger@1.31.4","maintainers":[{"name":"percy-admin","email":"apps+npm@percy.io"}],"homepage":"https://github.com/percy/cli#readme","bugs":{"url":"https://github.com/percy/cli/issues"},"dist":{"shasum":"62b7892fff145cd74efcc075d492f4b40146c784","tarball":"http://registry-npm.ywwl.com/@percy/logger/download/@percy/logger-1.31.4.tgz","fileCount":8,"integrity":"sha512-UUvazqokTMYKQ7MItwJ9jfSprnIpIysjbgAb+9z7mKF2yfG3LP99wwk785M9wSapq6SZH8sG2M1sbrmQ8HzqQQ==","signatures":[{"sig":"MEUCIFB1d9DjXu/enw1j4yQ8ZHJU1zw0p5L/1U9YuBwW+TlOAiEAmJzIQgwWTn7QopVTKEtgf+8D73v7KAHdFEeXYOH4r/E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18079,"size":6797,"noattachment":false,"key":"/@percy/logger/-/@percy/logger-1.31.4.tgz"},"main":"./dist/index.js","type":"module","engines":{"node":">=14"},"exports":{".":"./dist/index.js","./utils":"./dist/utils.js","./test/client":"./test/client.js","./test/helpers":"./test/helpers.js"},"gitHead":"ae9af7043b17186a26e4b8c584faa45559260f9e","scripts":{"lint":"eslint --ignore-path ../../.gitignore .","test":"node ../../scripts/test","build":"node ../../scripts/build","test:coverage":"yarn test --coverage"},"_npmUser":{"name":"percy-admin","email":"apps+npm@percy.io"},"repository":{"url":"git+https://github.com/percy/cli.git","type":"git","directory":"packages/logger"},"_npmVersion":"lerna/6.0.1/node@v14.21.3+x64 (linux)","description":"Common logger used throughout the Percy CLI and SDKs.","directories":{},"_nodeVersion":"14.21.3","publishConfig":{"tag":"latest","access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/logger_1.31.4_1760609703448_0.4688875419508203","host":"s3://npm-registry-packages-npm-production"},"readme":"# @percy/logger\n\nCommon logger used throughout the Percy CLI and SDKs.\n\n- [Usage](#usage)\n  - [`logger()`](#loggerdebug)\n  - [`logger.loglevel()`](#loggerloglevel)\n  - [`logger.format()`](#loggerformat)\n  - [`logger.query()`](#loggerquery)\n\n## Usage\n\n``` js\nimport logger from '@percy/logger'\n\nconst log = logger('foobar')\n\nlog.info('info message')\nlog.error('error message')\nlog.warn('warning message')\nlog.debug('debug message')\nlog.deprecated('deprecation message')\n```\n\n### `logger([debug])`\n\nCreates a group of logging functions that will be associated with the provided `debug` label. When\ndebug logging is enabled, this label is printed with the `[percy:*]` label and can be filtered via\nthe `PERCY_DEBUG` environment variable.\n\n``` js\nPERCY_DEBUG=\"one:*,*:a,-*:b\"\n\nlogger.loglevel('debug')\n\nlogger('one').debug('test')\nlogger('one:a').debug('test')\nlogger('one:b').debug('test')\nlogger('one:c').debug('test')\nlogger('two').debug('test')\nlogger('two:a').debug('test')\n\n// only logs from the matching debug string are printed\n//=> [percy:one] test\n//=> [percy:one:a] test\n//=> [percy:one:c] test\n//=> [percy:two:a] test\n```\n\n### `logger.loglevel([level][, flags])`\n\nSets or retrieves the log level of the shared logger. If the second argument is provided, `level` is\ntreated as a fallback when all logging flags are `false`. When no arguments are provided, the method\nwill return the current log level of the shared logger.\n\n``` js\nlogger.loglevel('info', { verbose: true })\nlogger.loglevel() === 'debug'\n\nlogger.loglevel('info', { quiet: true })\nlogger.loglevel() === 'warn'\n\nlogger.loglevel('info', { silent: true })\nlogget.loglevel() === 'silent'\n\nlogger.loglevel('info')\nlogger.loglevel() === 'info'\n```\n\n### `logger.format(message, debug[, level])`\n\nReturns a formatted `message` depending on the provided level and logger's own log level. When\ndebugging, the `debug` label is added to the prepended `[percy:*]` label.\n\n``` js\nlogger.format('foobar', 'test')\n//=> [percy] foobar\n\nlogger.loglevel('debug')\nlogger.format('foobar', 'test', warn')\n//=> [percy:test] foobar (yellow for warnings)\n```\n\n### `logger.query(filter)`\n\nReturns an array of logs matching the provided filter function.\n\n``` js\nlet logs = logger.query(log => {\n  return log.level === 'debug' &&\n    log.message.match(/foobar/)\n})\n```\n","publish_time":1760609703654,"_cnpm_publish_time":1760609703654,"dist-tags":{"alpha":"1.31.15-alpha.0","beta":"1.33.2-beta.0","latest":"1.33.1"}}