{"name":"log","description":"Tiny logger with streaming reader","version":"1.3.1","author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"keywords":["log","logger"],"main":"./lib/log.js","engines":{"node":">= 0.2.0"},"_id":"log@1.3.1","dist":{"shasum":"ef958e3d4fce0a1bc1f10be2a9b39ddb0d58ae3b","tarball":"http://registry-npm.ywwl.com/log/download/log-1.3.1.tgz","integrity":"sha512-HTBqDAn0Prp8dAlBBufoz+b1DdJELySEsFLTXMiz/JIt5wO7VPMKyS1/+LUPagVH31bIZGsE0yYshYkTHzeFcA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE+GD7M1aWozu/M9hBUuC0AH1Upf8Hh2l+2bLm+hVFr/AiEApGwp9l3DDC64GZsivZOW9UqTzeckNPur4H0lWYrakQM="}],"size":5431,"noattachment":false,"key":"/log/-/log-1.3.1.tgz"},"_npmVersion":"1.2.0","_npmUser":{"name":"tjholowaychuk","email":"tj@vision-media.ca"},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"directories":{},"readme":"[![Build status][build-image]][build-url]\n[![Tests coverage][cov-image]][cov-url]\n[![npm version][npm-image]][npm-url]\n\n# log\n\n## Universal logging utility\n\n**Configurable, environment and presentation agnostic, with log levels and namespacing ([debug](https://github.com/visionmedia/debug#debug) style) support**\n\n### Usage\n\n#### 1. Write application/library logs\n\n```javascript\n// Default logger (writes at 'info' level)\nconst log = require(\"log\");\n\n// Log 'info' level message:\nlog.info(\"some info message %s\", \"injected string\");\n\n// Get namespaced logger (debug lib style)\nconst myLibLog = log.get(\"my-lib\");\n\n// Log 'info' level message in context of 'my-lib' namespace:\nmyLibLog.info(\"some info message in 'my-lib' namespace context\");\n\n// Namespaces can be further nested\nconst myLibFuncLog = log.get(\"func\");\n\n// Log 'info' level message in context of 'my-lib:func' namespace:\nmyLibFuncLog.info(\"some info message in 'my-lib:func' namespace context\");\n\n// Log 'error' level message in context of 'my-lib:func' namespace:\nmyLibFuncLog.error(\"some error message\");\n\n// log output can be dynamically enabled/disabled during runtime\nconst { restore } = myLibFuncLog.error.disable();\nmyLibFuncLog.error(\"error message not really logged\");\n// Restore previous logs visibiity state\nrestore();\nmyLibFuncLog.error(\"error message to be logged\");\n```\n\n#### 2. Initialize log writer in main (starting) process module\n\ne.g. if target is Node.js, then install `log-node`, and at the top of main module initialize it\n\n```javascript\nrequire(\"log-node\")();\n```\n\n### Available log levels\n\nMirror of applicable syslog levels (in severity order):\n\n- `debug` - debugging information (hidden by default)\n- `info` - a purely informational message (hidden by default)\n- `notice` - condition normal, but significant\n- `warning` (also aliased as `warn`) - condition warning\n- `error` - condition error - to notify of errors accompanied with recovery mechanism (hence reported as log and not as uncaught exception)\n\n_Note: `critical`, `alert`, `emergency` are not exposed as seem to not serve a use case in context of JS applications,\nsuch errors should be exposed as typical exceptions_\n\n### Output message formatting\n\n`log` doesn't force any specific arguments handling. Still it is recommended to assume [printf-like](https://en.wikipedia.org/wiki/Printf_format_string) message\nformat, as all currently available writers are setup to support it. Placeholders support reflects one implemented in Node.js [format](https://nodejs.org/api/util.html#util_util_format_format_args) util\n\nExcerpt from Node.js documentation:\n\n_The first argument is a string containing zero or more placeholder tokens. Each placeholder token is replaced with the converted value from the corresponding argument. Supported placeholders are:_\n\n- _`%s` - String._\n- _`%d` - Number (integer or floating point value)._\n- _`%i` - Integer._\n- _`%f` - Floating point value._\n- _`%j` - JSON. Replaced with the string '[Circular]' if the argument contains circular references._\n- _`%o` - Object. A string representation of an object with generic JavaScript object formatting. Similar to util.inspect() with options { showHidden: true, depth: 4, showProxy: true }. This will show the full object including non-enumerable symbols and properties._\n- _`%O` - Object. A string representation of an object with generic JavaScript object formatting. Similar to util.inspect() without options. This will show the full object not including non-enumerable symbols and properties._\n- _`%%` - single percent sign ('%'). This does not consume an argument._\n\n_Note to log writer configuration developers: For cross-env compatibility it is advised to base implementation on [sprintf-kit](https://github.com/medikoo/sprintf-kit)_\n\n### Enabling log writing\n\n`log` on its own doesn't write anything to the console or any other means (it just emits events to be consumed by preloaded log writers).\n\nTo have logs written, the pre-chosen log writer needs to be initialized in the main (starting) module of a process.\n\n#### List of available log writers\n\n- [`log-node`](https://github.com/medikoo/log-node) - For typical Node.js processes\n- [`log-aws-lambda`](https://github.com/medikoo/log-aws-lambda) - For AWS lambda environment\n\n_Note: if some writer is missing, propose a PR_\n\n### Logs Visibility\n\nDefault visibility depends on the enviroment (see chosen log writer for more information), and in most cases is setup through the following environment variables:\n\n##### `LOG_LEVEL`\n\n(defaults to `notice`) Lowest log level from which (upwards) all logs will be exposed.\n\n##### `LOG_DEBUG`\n\nEventual list of namespaces to expose at levels below `LOG_LEVEL` threshold\n\nList is comma separated as e.g. `foo,-foo:bar` (expose all `foo` but not `foo:bar`).\n\nIt follows convention configured within [debug](https://github.com/visionmedia/debug#windows-note). To ease eventual migration from [debug](https://github.com/visionmedia/debug), configuration fallbacks to `DEBUG` env var if `LOG_DEBUG` is not present.\n\n### Timestamps logging\n\nWhen following env var is set writers are recommended to expose timestamps aside each log message\n\n##### `LOG_TIME`\n\n- `rel` (default) - Logs time elapsed since logger initialization\n- `abs` - Logs absolute time in ISO 8601 format\n\n## Tests\n\n    $ npm test\n\nProject cross-browser compatibility supported by:\n\n<a href=\"https://browserstack.com\"><img src=\"https://bstacksupport.zendesk.com/attachments/token/Pj5uf2x5GU9BvWErqAr51Jh2R/?name=browserstack-logo-600x315.png\" height=\"150\" /></a>\n\n## Security contact information\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-log?utm_source=npm-log&utm_medium=referral&utm_campaign=readme\">Get professional support for d with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n\n[build-image]: https://github.com/medikoo/log/workflows/Integrate/badge.svg\n[build-url]: https://github.com/medikoo/log/actions?query=workflow%3AIntegrate\n[cov-image]: https://img.shields.io/codecov/c/github/medikoo/log.svg\n[cov-url]: https://codecov.io/gh/medikoo/log\n[npm-image]: https://img.shields.io/npm/v/log.svg\n[npm-url]: https://www.npmjs.com/package/log\n","publish_time":1358441616373,"_cnpm_publish_time":1358441616373,"dist-tags":{"latest":"6.3.2"}}