{"name":"zlogger","version":"1.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.3.5","split2":"^2.1.0","through2":"^2.0.1"},"devDependencies":{"egg-ci":"^1.0.0","egg-bin":"^1.0.0","autod":"^2.7.1","coffee":"^3.3.0","eslint":"^3.10.2","eslint-config-egg":"^3.2.0","intelli-espower-loader":"^1.0.1","power-assert":"^1.4.2"},"engines":{"node":">=4.3.1"},"ci":{"version":"4, 6, 7"},"scripts":{"test":"npm run lint && npm run test-local","test-local":"egg-bin test -r intelli-espower-loader","cov":"egg-bin cov -r intelli-espower-loader","lint":"eslint .","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","gitHead":"fb519f7c714862bf2b97e30be85e374b34ad9ee2","bugs":{"url":"https://github.com/node-modules/zlogger/issues"},"_id":"zlogger@1.0.0","_shasum":"330b0f030e299d014296830fa30e20b94d826eb7","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"dist":{"shasum":"330b0f030e299d014296830fa30e20b94d826eb7","tarball":"http://registry-npm.ywwl.com/zlogger/download/zlogger-1.0.0.tgz","integrity":"sha512-Ao31BDsirVWMRdWEGXunMaOzbN2E/i+mHFviJIC8bnBKz+4eyaVRuJ+yFla9DtY2YZAEZNcHlcObVYJ08YrcDA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCsA2lyTa+m0x1WTYhGSzfltvBBUE51hqn+qqnoJLZXgIgPx3kT22moH1YUPjcg4EF97TR8wQkhOsrMx/qludey3Y="}],"size":4257,"noattachment":false,"key":"/zlogger/-/zlogger-1.0.0.tgz"},"maintainers":[{"name":"popomore","email":"sakura9515@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/zlogger-1.0.0.tgz_1480405875379_0.7876211616676301"},"directories":{},"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":1480405875949,"_cnpm_publish_time":1480405875949,"dist-tags":{"latest":"2.1.1"}}