{"name":"@wdio/logger","version":"5.6.4","keywords":["webdriver","wdio","wdio-utility"],"author":{"name":"Christian Bromann","email":"christian@saucelabs.com"},"license":"MIT","_id":"@wdio/logger@5.6.4","homepage":"https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-logger","bugs":{"url":"https://github.com/webdriverio/webdriverio/issues"},"dist":{"shasum":"465aa3487ea9d5439a02926da8fee3a223b50f66","tarball":"http://registry-npm.ywwl.com/@wdio/logger/download/@wdio/logger-5.6.4.tgz","fileCount":5,"integrity":"sha512-AgG/8H1ivlV8z/QUPHC3SqA7xfqboVfrWCm92fXRma/9UXUT5HgqNe2NYi6fld/+zOHsb4TIX7jLSarSAeRUIg==","signatures":[{"sig":"MEQCIGZ5VMsZpwCs9XFiSY/CfhmkddsQXdp71PAocrgNuws/AiAehXoEKxKiHpLPx2dxemc/IzIIIe4r4QCwHSS/nG0KVA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7156,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcd/2ICRA9TVsSAnZWagAARQgQAJUKyG/3bRIkRUbBo2NC\n8VY0oRjS7E/Sgwg0fpl+Z7OwpcUxLqGSlJ/lSQ0fII9+pv+bvFmJh6OcbEPa\nQXtnB/9PxhxKa6U5/+vY494WTzJvsDwHVdi36TzrJNgTdQzPaxAPxL40M+B7\nPtVP0hDSVOOUPrFsxlUk0if7iHfsCG2knZpif17NvZs6CUUA4QQofXqBbgP9\nmjPfT0+KOSU/BQJUvULSfDG5Q35UBf/GlLxVNwBZyeUtc/k9ymeVT4etgcvn\n9Vg6ZzS0mYckLMp5OcWHLWycYivd0MlOibjr17aeXiUccBaCLeV/BNo23ZRe\njfqN+Y4mkCXokQCneNcm7HxYfxCngapgLxVGjZpYt+u6+HJWE9UmvHfhC+o2\ngdi+dJZEfwhfR8hia7Ecpn+5lfnB1ovyixIgaKJi/1o1GCeKrh5u67gqVNgQ\nndHqosk71W2wOkMhXPmpm2IU6cdsgWWd91QmkGgAdBVLEMoQgBg2QoQtaoH9\nxtDb54rXQF035wUpZUEdMuI2bGqH+OaG6XoAivIt3hGSbcXOwrqNTiArvwzJ\ngpE6OQpXE3R8VFPCvsaYjX8pOn5sk/KYg7fiS7a+XARwtz/6Z/XbxGnaFqX4\nwoBG/8xBtBktJDuqu+vIIjeAkqVoCP2boDdeYmzh3mAqfnAOjvwezwEB7/OS\nswsE\r\n=+/Xr\r\n-----END PGP SIGNATURE-----\r\n","size":2953,"noattachment":false,"key":"/@wdio/logger/-/@wdio/logger-5.6.4.tgz"},"main":"./build/index","engines":{"node":">= 8.11.0"},"gitHead":"09f998f9e785873378b4436fd39c4dc37aa6e248","scripts":{"test":"run-s test:*","build":"run-s clean compile","clean":"rimraf ./build","compile":"babel src/ -d build/ --config-file ../../babel.config.js","test:unit":"jest","test:eslint":"eslint src test"},"_npmUser":{"name":"christian-bromann","email":"christian@saucelabs.com"},"repository":{"url":"git://github.com/webdriverio/webdriverio.git","type":"git"},"_npmVersion":"lerna/3.13.0/node@v10.14.2+x64 (darwin)","description":"A helper utility for logging of WebdriverIO packages","directories":{},"_nodeVersion":"10.14.2","dependencies":{"chalk":"^2.3.0","loglevel":"^1.6.0","strip-ansi":"^4.0.0","loglevel-plugin-prefix":"^0.5.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/logger_5.6.4_1551367559987_0.6963656627765384","host":"s3://npm-registry-packages"},"readme":"WDIO Logger Utility\n===================\n\n> A helper utility for logging of WebdriverIO packages\n\nThis package is used across all WebdriverIO packages to log information using the [`loglevel`](https://www.npmjs.com/package/loglevel) package. It can also be used for any other arbitrary Node.js project.\n\n## Install\n\nTo install the package just call\n\n```sh\nnpm install @wdio/logger\n```\n\nor when adding it to a WebdriverIO subpackage:\n\n```sh\nlerna add @wdio/logger --scope <subpackage>\n```\n\n## Usage\n\nThe package exposes a logger function that you can use to register an instance for your scoped package:\n\n```js\nimport logger from '@wdio/logger'\n\nconst log = logger('myPackage')\nlog.info('some logs')\n```\n\nFor more info see [`loglevel`](https://www.npmjs.com/package/loglevel) package on NPM.\n\n## Custom Log Levels\n\nThis package extends the log levels available in [`loglevel`](https://www.npmjs.com/package/loglevel) by introducing a new level called `progress`.\n\nThe `progress` level is particularly useful when you need to dynamically update a specific line in the terminal. For example, it can be utilized to display the download progress of browsers or drivers.\n\nNotably, the `progress` level is equivalent to the `info` level. Therefore, if you set the log level to `error` or `silent`, any `progress` logs will be suppressed.\n\nIt's important to mention that `progress` writes directly to `process.stdout`, and these logs won't be captured in any log files.\n\nTo ensure consistent formatting with subsequent logs while using `progress`, it's essential to clear it at the end. To do so, simply call `progress` with an empty string, which will clear the last line:\n\n```\nlog.progress('')\n```\n\n### Illustrative Usage of Progress\n\n```javascript\nimport logger from '@wdio/logger';\n\nconst log = logger('internal');\n\nconst totalSize = 100;\nlet uploadedSize = 0;\n\nconst uploadInterval = setInterval(() => {\n\tconst chunkSize = 10;\n\tuploadedSize += chunkSize;\n\tconst data = `Progress: ${(uploadedSize * 100) / totalSize}%`;\n\tlog.progress(data);\n\tif (uploadedSize >= totalSize) {\n\t\tclearInterval(uploadInterval);\n\t\tlog.progress(''); // Called at the end to maintain the alignment of subsequent logs.\n\t\tconsole.log('Upload complete.');\n\t}\n}, 100);\n```\n\n## Masking Patterns\n\nFor more secure logging, `setMaskingPatterns`, `WDIO_LOG_MASKING_PATTERNS` or `maskingPatterns` can obfuscate sensitive information from the log.\nFor example, we can replace `--key=MySecretKey` with `--key=**MASKED**` to hide your cloud service access key or secret key\n - The regular expression pattern must be provided as a string similar as a RegEx but as string type, for example, `--key=[^ ]*`\n - It support flags and capturing groups like `/--key=([^ ]*)/i`\n - Multiple patterns are separated by a comma, like `--key=([^ ]*),secrets=([^ ]*)`\n - If no capturing group is provided, the entire matching string of the pattern is masked\n - If one or more capturing groups are provided, we replace all the matching groups with `**MASKED**`\n - If there are multiple matches for a single group, we replace them all, too\n - Support both masking in a file and the console\n    - Note: In the console, when masking, some colors get stripped, which is a known limitation\n\n`setMaskingPatterns` example\n ```javascript\nimport logger from '@wdio/logger';\n\n// Default for all loggers\nlogger.setMaskingPatterns('/--key=([^ ]*)/i,/--secrets=([^ ]*)/i')\n\n// For a specific logger\nlogger.setMaskingPatterns({'internal' : '/--key=([^ ]*)/i,/--secrets=([^ ]*)/i'})\nconst log = logger('internal');\n```\n\nUsing wdio config from a `conf.ts` file, we can also configure masking patterns\n```javascript\nexport const config: WebdriverIO.Config = {\n    /**\n     * test configurations\n     */\n    logLevel: 'debug',\n    maskingPatterns: '/--key=([^ ]*)/i,/--secrets=([^ ]*)/i',\n}\n```\n\nFor secrets passed via the command line, masking may fail because the wdio.conf.ts file is parsed later in the execution cycle. Using environment variables for these cases is highly recommended and much safer.\n\nBelow are examples with the environment variable `WDIO_LOG_MASKING_PATTERNS` in the code directly:\n\n```javascript\n// Using environment variable in code\nprocess.env.WDIO_LOG_MASKING_PATTERNS = '/--key=([^ ]*)/i,/--secrets=([^ ]*)/i'\n```\n\nOr before your command line\n```shell\nWDIO_LOG_MASKING_PATTERNS='RESULT ([^ ]*)' npx wdio run ./wdio/wdio.conf.ts\n```\n","publish_time":1551367560132,"maintainers":[{"name":"christian-bromann","email":"mail@bromann.dev"},{"name":"wdio-user","email":"bot@webdriver.io"},{"name":"wswebcreation-nl","email":"wim@wswebcreation.nl"}],"_cnpm_publish_time":1551367560132,"dist-tags":{"beta":"7.0.0-beta.1","latest":"10.2.0","next":"10.2.0-alpha.100.sha-b38abd894","v9":"9.33.1"}}