{"name":"zlogger","version":"2.0.0","description":"The last console logger","repository":{"type":"git","url":"git+ssh://git@github.com/node-modules/zlogger.git"},"homepage":"https://github.com/node-modules/zlogger","keywords":["logger","console","stream"],"dependencies":{"pumpify":"^1.5.1","split2":"^3.1.0","through2":"^3.0.0"},"devDependencies":{"autod":"^3.0.1","coffee":"^5.1.1","egg-bin":"^4.9.0","egg-ci":"^1.11.0","eslint":"^5.10.0","eslint-config-egg":"^7.1.0"},"engines":{"node":">=8"},"ci":{"version":"8, 10"},"scripts":{"test":"npm run lint && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","lint":"eslint .","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","gitHead":"b2cb68564f686e95ec67cd1d5d000f5a339717f2","bugs":{"url":"https://github.com/node-modules/zlogger/issues"},"_id":"zlogger@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.4.0","_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"dist":{"integrity":"sha512-SGILpmT0kdQE9eMDFNP+IzOAE8++TthIOb7NeL9uYplpIkVlNBM1jD4WnfLyTzSHS5oKqpUAPSveJrkwKMjzLQ==","shasum":"a8c1003d62cc57b7d6e8cf2ef895de9b96992110","tarball":"http://registry-npm.ywwl.com/zlogger/download/zlogger-2.0.0.tgz","fileCount":4,"unpackedSize":8609,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcGgF3CRA9TVsSAnZWagAAw1IP/AwM+88CUCLwqLtcI1Jj\nDFgR5WXxEaM/05+emX+3MtAeDEKJHRtfrxAXJed1dmhxgb9eS0FWN+ts/aL2\n2k/L+UThOCclETq0IAxErFI2ZNb6HXIbtETmKulYeDt6FCdnts6X2d30fU22\nk8svom32kDFTH10mtL2cBwcIBCrhjOudbXK5mT3Jmr2QggBA6/DuN3DnLhc6\nth382OkXkDaL9pg9ynHKlpv7B2eDHRWjrm8qVuAnucYErqKb4E+Yoe7AevuX\nbb94WP9IQgW3c/v5O3cwO36NLhl3APVqbNE3k1qmr45YSqJyVehIh4sn7/e7\n6064/ecFOJqautPAQBhmmO6A18T4AS5z3doSw8oKM4NgyzTdb4kjz3cS627+\n8p0GQN2T9xnHrzqYYsus9WcljiQlkDZH1WlamcY3pYGcFgROH2Wk5AdRWUNC\nXMRkYUjORbQo70Gu12JZb+IdQ4BTMqlrvigfm26DiQnXgkhCchHMXGVQj4uf\n57IHm1LoxygsQO7cjz97ttF5goDzALD8jj96broQ0VfEzuBrMsT1Gom+cq9+\ns78iRktjh4Zv9laE47c1XF8k3y4tRENhTC8NOFeu78TzfESMCkHIDxY0NDKG\nl6OocVXu9Yy1yP5fOE8mdgGNFzzJoy/2ZCSmJ+jCbu1b7oCpvq9C0HFlgiD/\ngRwO\r\n=3xHx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB9/WmbJA79Jy5uXNe/j7wYnvPfeyoJBGfJ26VyWy+KNAiBp+rXbw1sD0p0GBumZzb6+BefoLIBu5TABNHM0GOo2xQ=="}],"size":3238,"noattachment":false,"key":"/zlogger/-/zlogger-2.0.0.tgz"},"maintainers":[{"name":"popomore","email":"sakura9515@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zlogger_2.0.0_1545208182857_0.6826562751227556"},"_hasShrinkwrap":false,"readme":"# zlogger\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/zlogger.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/zlogger\n[travis-image]: https://img.shields.io/travis/node-modules/zlogger.svg?style=flat-square\n[travis-url]: https://travis-ci.org/node-modules/zlogger\n[codecov-image]: https://codecov.io/gh/node-modules/zlogger/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/node-modules/zlogger\n[david-image]: https://img.shields.io/david/node-modules/zlogger.svg?style=flat-square\n[david-url]: https://david-dm.org/node-modules/zlogger\n[snyk-image]: https://snyk.io/test/npm/zlogger/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/zlogger\n[download-image]: https://img.shields.io/npm/dm/zlogger.svg?style=flat-square\n[download-url]: https://npmjs.org/package/zlogger\n\nThe last console logger\n\n## Installation\n\n```bash\nnpm install --save zlogger\n```\n\n## Feature\n\n- ✔︎ Extends [Console](https://nodejs.org/api/console.html#console_new_console_stdout_stderr)\n- ✔︎ Support custom prefix before every line\n- ✔︎ Support custom stdout and stderr\n- ✔︎ Support print time\n- ✔︎ Support child logger\n- ✔︎ Support logger level\n\n## Usage\n\nzlogger is same as global `console` which has `.log`, `.info`, `.warn`, `.error`.\n\nEvery line will start with `prefix` that you customize.\n\n```js\nconst logger = new ConsoleLogger({\n  prefix: '> ',\n});\n```\n\nSupport log level: `DEBUG` / `INFO` / `WARN` / `ERROR`.\n\n```js\nconst logger = new ConsoleLogger({\n  prefix: '> ',\n  level: 'WARN',\n});\n\nlogger.error('msg_error');\nlogger.info('msg_info');\n\n// [15:03:46] prefix > msg_error\n```\n\nSpecify stdout/stderr, default is `process.stdout/process.stderr`, you can use `fs` if you want to print to file.\n\n```js\nconst logger = new ConsoleLogger({\n  stdout: fs.createWriteStream('stdout.log'),\n  stderr: fs.createWriteStream('stderr.log'),\n});\nlogger.info('info');\nlogger.error('error');\n\n// cat stdout.log\n// cat stderr.log\n```\n\nYou can create a child logger, the first argument can be a ChildProcess or writable stream. If you give a prefix, it will print after prefix defined by the parent logger.\n\n```js\nconst cp = require('child_process');\nconst logger = new ConsoleLogger({\n  prefix: 'prefix > ',\n});\nlogger.info('see directory')\n\nconst ls = cp.spawn('ls', { cwd: __dirname });\nlogger.child(ls, '> ');\n\n// [15:03:46] prefix > see directory\n// [15:03:46] prefix > > History.md\n// [15:03:46] prefix > > README.md\n// [15:03:46] prefix > > index.js\n// [15:03:46] prefix > > node_modules\n// [15:03:46] prefix > > package.json\n// [15:03:46] prefix > > test\n```\n\n`.child` will return a new logger.\n\n```js\nconst logger = new ConsoleLogger({\n  prefix: 'parent> ',\n});\nlogger.info('parent');\n\nconst child = logger.child('child> ');\nchild.info('child');\n\n// [15:02:43] parent> parent\n// [15:02:43] parent> child> child\n```\n\nIt will print time before prefix, format is `[HH:MM:SS] `, but you can disable it.\n\n## Options\n\n- {WriteStream} stdout - stdout, `.log` and `.info` will pipe to it，default is process.stdout\n- {WriteStream} stderr - stderr, `.warn` and `.error` will pipe to it，default is process.stderr\n- {String|Function} prefix - every line will start with `prefix`, if it's a function, it will be called every line print.\n- {Boolean} time - print time\n- {String|Number} level - log level\n\n## License\n\n(The MIT License)\n","publish_time":1545208182978,"_cnpm_publish_time":1545208182978,"dist-tags":{"latest":"2.1.1"}}