{"_id":"stdlog","_rev":"62-e776ddba5d6d46e1ffcdc5c7f206c044","name":"stdlog","description":"A Node.js log utility that logs messages to stderr by default.","dist-tags":{"latest":"0.0.8"},"versions":{"0.0.1":{"name":"stdlog","version":"0.0.1","description":"A Node.js log utility that logs messages to stderr by default.","keywords":["stderr","logging"],"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"main":"./stdlog.js","dependencies":{"strformat":"0.x.x"},"_id":"stdlog@0.0.1","dist":{"shasum":"c762dffda2cbdc13364f991f26797d859f0b819f","tarball":"https://registry.npmjs.org/stdlog/-/stdlog-0.0.1.tgz","integrity":"sha512-qbodmFDS/UyvwBX26TKnPKwz6m3sgXNZHQ7K8mfxVYDhnES2SgZmfomXEAD5zmltAnuQ6Nutf9YUqMdhnMDeNg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHB8SSWAA3FwtnlVTVktFUr+eljDi0prC/IZ+Em6GQEuAiBrRc9nvZdZrgW/o8jcb9n4svn7rvAN1XMEul52+kMT2A=="}]},"maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"directories":{},"deprecated":"Please use the pkglogger package instead."},"0.0.2":{"name":"stdlog","version":"0.0.2","description":"A Node.js log utility that logs messages to stderr by default.","keywords":["stderr","logging"],"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"main":"./stdlog.js","dependencies":{"strformat":"0.x.x"},"_id":"stdlog@0.0.2","dist":{"shasum":"aaa76daa89ec87014019d539a339e638656de4bf","tarball":"https://registry.npmjs.org/stdlog/-/stdlog-0.0.2.tgz","integrity":"sha512-2RptWiBfL8pHGuyXnwm+UIN/N1PjUyWB/xO2V7ZJA5PORweay0z38luQHzkqSSqWy4rRGVsnw10pY9mo3ocEAw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCoXapFgdcTB7msFL7MEp6797nFrs2ccA7TI6G8vicdvQIhAIVhCurC5JUtkwoZpv3mFwySsJEhGJFdYjfmVGGHJ3kp"}]},"maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"directories":{},"deprecated":"Please use the pkglogger package instead."},"0.0.3":{"name":"stdlog","version":"0.0.3","description":"A Node.js log utility that logs messages to stderr by default.","keywords":["stderr","logging"],"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"main":"./stdlog.js","dependencies":{"strformat":"0.x.x"},"_id":"stdlog@0.0.3","dist":{"shasum":"a1a0a28ad0282fe54924fa7815599e2c71141a58","tarball":"https://registry.npmjs.org/stdlog/-/stdlog-0.0.3.tgz","integrity":"sha512-nAcjJki2Rl6kTEjfFhBjrRlFS+4NIHLDsJ4vtio60BXgEjoQhkodS9K7XBaKzxtOeO6cxt5leYTghaSQiBSbrg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFtBXl5n0W7rG2YC8gx+QIKXmTJwynXsBHiMlJrmte/AAiEA8gj/M3HkOMoGZJ/vzC4rSssBt6IDCW5fS41zQM5kyqc="}]},"maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"directories":{},"deprecated":"Please use the pkglogger package instead."},"0.0.4":{"name":"stdlog","version":"0.0.4","description":"A Node.js log utility that logs messages to stderr by default.","keywords":["stderr","logging"],"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"main":"./stdlog.js","dependencies":{"strformat":"0.0.x","findpkg":"0.0.x"},"_id":"stdlog@0.0.4","dist":{"shasum":"3564450165314162c264c8492b6232d94640b9f4","tarball":"https://registry.npmjs.org/stdlog/-/stdlog-0.0.4.tgz","integrity":"sha512-daPueSP7oPrrwvNaZWXz4xqqwRqzcc/r+F4y6bVuUXSBTHJpJvUH+Le6HieUJmtef8QuRwDhQIrtGD8+6dxdAQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFbvXL80FxGxcIAirLjiExU2l7TWCR9BeNBJ6f2qczLdAiAm/QTHv7dx5MVWCZW6ItuGAwp3yB3UBEOTvDDrbGw44Q=="}]},"_npmVersion":"1.1.61","_npmUser":{"name":"fhellwig","email":"frank@hellwig.org"},"maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"directories":{},"deprecated":"Please use the pkglogger package instead."},"0.0.5":{"name":"stdlog","version":"0.0.5","description":"A Node.js log utility that logs messages to stderr by default.","keywords":["stderr","logging"],"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"main":"./lib/stdlog.js","dependencies":{"strformat":"0.0.x","findpkg":"0.0.x"},"_id":"stdlog@0.0.5","dist":{"shasum":"4f4deceebe17e660f32f1fa5ed52c20860885ab1","tarball":"https://registry.npmjs.org/stdlog/-/stdlog-0.0.5.tgz","integrity":"sha512-Pd9+RBmZsfP5qRl3YDzr9+h5cAHNElKsL4snBsxhDO7O7KnBnhwU0VeksdYWSpkEOZZqykm7UagAj/sIz2I5oA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDoYi6QfQqjqg4JoykFtgJEFsvSU3MrWvDwWxkxiO08bAIgBfQTdjQaamKEXOoAnCJw5vINYfSn3h89TADF3aSUIUM="}]},"_npmVersion":"1.1.61","_npmUser":{"name":"fhellwig","email":"frank@hellwig.org"},"maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"directories":{},"deprecated":"Please use the pkglogger package instead."},"0.0.6":{"name":"stdlog","version":"0.0.6","description":"A Node.js log utility that logs messages to stderr by default.","keywords":["stderr","logging"],"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"main":"./lib/stdlog.js","dependencies":{"mkdirp":"0.3.x","strformat":"0.0.x","findpkg":"0.0.x"},"_id":"stdlog@0.0.6","dist":{"shasum":"d2dd03179422fe554abdd393249ebc84a315d382","tarball":"https://registry.npmjs.org/stdlog/-/stdlog-0.0.6.tgz","integrity":"sha512-D7KhBYjW0kKhfEFITqEDuIl7JJ1Rcf6uEUmgDEt9ZhC1wC1AiJrxH0dzYns0uXr6rnpkFJjj6RcnL/YtJI7hTw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDz0PQyDaszmI18ogeoZq8Zu1osDEDXD+6eJh6oUMNslQIgXq2yaY8DpsbkCcJvElfrlznpwLF1y9iGcPBly9mLIXs="}]},"_npmVersion":"1.1.61","_npmUser":{"name":"fhellwig","email":"frank@hellwig.org"},"maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"directories":{},"deprecated":"Please use the pkglogger package instead."},"0.0.7":{"name":"stdlog","version":"0.0.7","description":"A Node.js log utility that logs messages to stderr by default.","keywords":["stderr","logging"],"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"main":"./lib/stdlog.js","dependencies":{"mkdirp":"0.3.x","strformat":"0.0.x","findpkg":"0.0.x"},"_id":"stdlog@0.0.7","dist":{"shasum":"04ec94460bdab05819548681f07cc1dc4211c97e","tarball":"https://registry.npmjs.org/stdlog/-/stdlog-0.0.7.tgz","integrity":"sha512-eB+ohKOozsw1twIbOlKQ87p/4RhO7PdnChfuwPZED1DMLX55uUsJBCiqRn5LT39S2wpNkLeGeuYjYo9hZUiG9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBt34Drsk6dmkgAWoShch4gCthAZU8zQp3FhPYqGAOqtAiBPsL+YJXT6J99TwJKAfCEOYxPKnl+cgKf/+DvnQiutuA=="}]},"_npmVersion":"1.1.61","_npmUser":{"name":"fhellwig","email":"frank@hellwig.org"},"maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"directories":{},"deprecated":"Please use the pkglogger package instead."},"0.0.8":{"name":"stdlog","version":"0.0.8","description":"A Node.js log utility that logs messages to stderr by default.","keywords":["stderr","logging"],"licenses":[{"type":"MIT","url":"http://www.opensource.org/licenses/MIT"}],"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"main":"./lib/stdlog.js","dependencies":{"mkdirp":"0.3.x","strformat":"0.0.x","findpkg":"0.0.x"},"_id":"stdlog@0.0.8","dist":{"shasum":"31465646b513e8c1a4e608faf22b0fcfb4e9f38e","tarball":"https://registry.npmjs.org/stdlog/-/stdlog-0.0.8.tgz","integrity":"sha512-UQ7h+d1oislnalA6Gmps1NOcLxK6iDxuu3laT/okncJ1BU+Padoz8dnDpYPm5cA/10yK3tdSelABLjxCvx1pbg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEAdztI6H1nfTHwjWJjuonEho6vdPI1L5X58rBh/7OlwAiBykKOZ/hLp9/5xW49dGkjAUO0ODptcRscd/yRkz4SbqQ=="}]},"_npmVersion":"1.1.61","_npmUser":{"name":"fhellwig","email":"frank@hellwig.org"},"maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"directories":{},"deprecated":"Please use the pkglogger package instead."}},"readme":"# stdlog\r\n\r\nA node.js log utility that logs messages to stderr by default.\r\n\r\n## Overview\r\n\r\nThe stdlog package logs messages to stderr using five log levels: ERROR, WARN, INFO, DEBUG, and TRACE. An alternate stream or file can be used as well.\r\n\r\n## Installation\r\n\r\nAdd stdlog to your package.json dependencies:\r\n\r\n    \"dependencies\": {\r\n        ...,\r\n        \"stdlog\": \"1.0.x\"\r\n    }\r\n\r\nInstall the dependencies:\r\n\r\n    $ npm install\r\n\r\n## Usage\r\n\r\nRequire `stdlog` and create a `log` instance:\r\n\r\n```javascript\r\nvar stdlog = require('./stdlog');\r\n\r\n// Create a log and set the log level using a constant.\r\nvar log = stdlog({\r\n    level: stdlog.DEBUG\r\n});\r\n\r\nlog.warn('This is a warning');\r\nlog.trace('This is not logged');\r\n\r\n// Set the log level using a string.\r\nlog.setLevel('TRACE');\r\nlog.trace('Now it is logged');\r\n```\r\n\r\nOutput:\r\n\r\n```\r\n2014-05-28T03:50:02.194Z WARN stdlog.test[14644]: This is a warning\r\n2014-05-28T03:50:02.210Z TRACE stdlog.test[14644]: Now it is logged\r\n```\r\n\r\n## Logging\r\n\r\n### Log Levels\r\n\r\nThere are five log levels. Each level has a numeric value and a string name. \r\nThe numeric value and the string name can be used interchangeably. The name is \r\ncase-insensitive when used in the `setLevel` method or when specified as the\r\n`level` property in an options object.\r\n\r\n1. ERROR\r\n2. WARN\r\n3. INFO (this is the default log level)\r\n4. DEBUG\r\n5. TRACE\r\n\r\nIn addition, the log level having the numeric value zero (or the string name\r\nNONE) disables all logging.\r\n\r\n### Log Name\r\n\r\nThe log name comes from the package name of the application along with\r\nthe module name of the parent module (the module calling `require(stdlog`).\r\nFor example, the log name `myapp.server` is created from the package name\r\n(`myapp`) and the module requiring `stdlog` (`server.js`).\r\n \r\n### Log Methods\r\n\r\nThere are five corresponding log methods:\r\n\r\n    log.error(message [,args]);\r\n    log.warn(message [,args]);\r\n    log.info(message [,args]);\r\n    log.debug(message [,args]);\r\n    log.trace(message [,args]);\r\n\r\nEach of these takes a message string (or an object, such as an Error) as the\r\nfirst parameter. The message can contain optional placeholders that are\r\nreplaced by the values of any additional arguments.\r\n\r\n- If the first argument is an object, then that object is converted to a string and becomes the error message.\r\n\r\n- If the arguments following the `message` parameter are primitive values, then these values are accessed using numerical placeholders. For example, `{0}` is the first argument after the `message` parameter, `{1}` is the second argument after the `message` parameter, and so on.\r\n\r\n- If the first argument following the `message` parameter is an array, then the numeric placeholders are array index values (e.g., `{0}`, `{1}`, etc.).\r\n\r\n- If the first argument after the `message` argument is an object, then the placeholders are the object property names (e.g., `{code}`).\r\n\r\nSee Also: [strformat](https://github.com/fhellwig/strformat)\r\n\r\n## Configuration\r\n\r\nThere are three configuration options: level, output, and format.\r\nEach of these has a default value and can be set using an options property,\r\na configuration method, or by setting an environment variable.\r\n\r\n### Setting the Log Level\r\n\r\nThe default log level is INFO. The log level can be set using the `level`,\r\noptions property, the `setLevel({Number|String})` method, or by setting the\r\n`STDLOG_LEVEL` environment variable.\r\n\r\nThe value of the argument or the environment variable can be either a number,\r\nthe string representation of a number, or the case-insensitive log level name.\r\n\r\nNote that the `stdlog` module exports the log levels as constants. Therefore,\r\ncalling `log.setLevel(stdlog.DEBUG)` has the same result as calling\r\n`log.setLevel('debug')`.\r\n\r\n### Setting the Log Output\r\n\r\nThe default log output is *stderr*. The log output can be set by using the\r\n`output` options property, the `setOutput({Object|String})` method, or by\r\nsetting the `STDLOG_OUTPUT` environment variable.\r\n\r\nIf the argument is an object, then is must provide a `write` function.\r\n\r\nIf the argument is a string, then the following rules apply:\r\n\r\n1. The string `stderr` is interpreted as the *stderr* stream.\r\n2. The string `stdout` is interpreted as the *stdout* stream.\r\n3. Otherwise, the string is the pathname of a log file subject to the following:\r\n    - A string beginning with a dot is resolved against the current working directory.\r\n    - A string *not* beginning with a dot is resolved against the package or module directory of the parent module (the one requiring the stdlog package).\r\n\r\nIn the case of a log file, a file having the resolved name is created if it\r\ndoes not exist. Any intermediate directories (e.g., `logs`) are created using\r\nthe [mkdirp](https://github.com/substack/node-mkdirp) utility. Log messages\r\nare then appended to that file.\r\n\r\n### Setting the Log Format\r\n\r\nThe default log format is\r\n\r\n    {timestamp} {level} {name}[{pid}]: {message}\r\n    \r\nThe log format can be set using the `format` options property, by calling the\r\n`setFormat({String})` method, or by setting the `STDLOG_FORMAT` environment\r\nvariable.\r\n\r\nThe following placeholders are available for use in the log format\r\nspecification:\r\n\r\n- `{timestamp}` - The ISO 8601 timestamp string using the UTC timezone.\r\n- `{level}` - The log level name string (e.g., ERROR).\r\n- `{pid}` - The numeric process id.\r\n- `{name}` - The log name based on the package name and parent module name.\r\n- `{message}` - The log message. Embedded newline characters are prefixed with a greater-than sign followed by a space so that multi-line messages are easily identified and parsed.\r\n\r\n### Setting all Log Options\r\n\r\nAny or all of these options can be configured at once using the `setOptions({Object})` method:\r\n\r\n```javascript\r\nlog.setOptions({\r\n    level: 'trace',\r\n    output: './server.log',\r\n    format: '{level}: {message}'\r\n});\r\n```\r\n\r\n### Log Exceptions\r\n\r\nAn invalid value, such as an incorrect log level, results in an exception being thrown. Exceptions are thrown by the `setOptions` method as well as by any of the individual configuration methods.\r\n\r\n## Summary\r\n\r\n### Methods\r\n\r\n```javascript\r\nsetOptions({Object})\r\nsetLevel({Number|String}\r\nsetOutput({Object|String}\r\nsetFormat({String})\r\n```\r\n\r\n### Motivations\r\n\r\nThe following three points motivated the creation and design of the `stderr`\r\nutility:\r\n\r\n1. The `console` facility writes some messages to `stdout` and others to `stderr`. The UNIX convention is for `stdout` to be used for process output and `stderr` to be used for *sideband* information. The stdlog package logs all messages to `stderr` by default.\r\n\r\n2. There are many other logging packages available. Some provide interesting color coding, others offer sophisticated interfaces to network log aggregators. This utility is a simple stream-based logger with the ability of appending messages to a log file.\r\n\r\n3. The UNIX `syslog` facility offers more severity levels. This module is not intended for *system* logging so levels such as CRITICAL are of lesser value to a server operating as a guest process on an operating system. The five levels of ERROR, WARN, INFO, DEBUG, and TRACE offer a reasonable compromise.\r\n\r\n### Performance\r\n\r\nThe decision on whether or not to log a messages based on the current log level is made before any string formatting takes place. Therefore, log statements can be left in the code with minimal performance impact.\r\n\r\n## License\r\n\r\n(The MIT License)\r\n\r\nCopyright (c) 2014 Frank Hellwig\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n","maintainers":[{"name":"fhellwig","email":"frank@hellwig.org"}],"time":{"modified":"2022-06-27T00:13:43.684Z","created":"2012-08-17T05:25:00.442Z","0.0.1":"2012-08-17T05:25:00.882Z","0.0.2":"2012-08-21T13:45:19.786Z","0.0.3":"2012-08-24T20:22:11.040Z","0.0.4":"2012-09-11T20:10:34.359Z","0.0.5":"2012-09-24T13:46:20.163Z","0.0.6":"2012-09-24T18:12:03.560Z","0.0.7":"2012-09-24T18:46:37.406Z","0.0.8":"2012-09-24T18:55:14.208Z","1.0.0":"2014-05-28T04:00:37.831Z","1.0.1":"2014-05-28T22:32:14.796Z","1.0.2":"2014-05-29T00:33:47.220Z"},"author":{"name":"Frank Hellwig","email":"frank@hellwig.org"},"repository":{"type":"git","url":"git://github.com/fhellwig/stdlog.git"},"keywords":["stderr","logging"],"readmeFilename":"README.md"}