{"_id":"nanolog","_rev":"7-62f3b2a65a072b770fc06f8d870d0ece","name":"nanolog","description":"Flexible but Simple Logger","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"nanolog","author":{"name":"Wayne Larsen","email":"wayne@larsen.st"},"description":"Flexible but Simple Logger","version":"0.1.0","repository":{"url":"https://github.com/wvl/nanolog.git"},"homepage":"https://github.com/wvl/nanolog","bugs":{"url":"https://github.com/wvl/nanolog/issues"},"main":"lib/nanolog.js","engines":{"node":"*"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"wvl","email":"wayne@larsen.st"},"_id":"nanolog@0.1.0","_engineSupported":true,"_npmVersion":"1.1.0-alpha-2","_nodeVersion":"v0.6.3","_defaultsLoaded":true,"dist":{"shasum":"5db0f6d0a0e98f735a62b1d2f02ac6174eafbca6","tarball":"https://registry.npmjs.org/nanolog/-/nanolog-0.1.0.tgz","integrity":"sha512-Al6YLcaLdSFaco4YbX1N+QAZSAact/NIV+n2z+vzP1Xmdwa/FEvItg9CvW7vLe+q2d2kAacK6KpD3S3NW+/n2A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBwU/dShWQ7L5OeuVdF+GnyREdyEQX72jXJJUUDXvSO8AiEApa+TD4Syht8kIARBWSkACud0nHM/FDldKw9adFEk95w="}]},"maintainers":[{"name":"wvl","email":"wayne@larsen.st"}]},"0.1.1":{"name":"nanolog","author":{"name":"Wayne Larsen","email":"wayne@larsen.st"},"description":"Flexible but Simple Logger","version":"0.1.1","license":"MIT","repository":{"url":"https://github.com/wvl/nanolog.git"},"homepage":"https://github.com/wvl/nanolog","bugs":{"url":"https://github.com/wvl/nanolog/issues"},"main":"lib/nanolog.js","engines":{"node":"*"},"dependencies":{},"devDependencies":{},"_npmUser":{"name":"wvl","email":"wayne@larsen.st"},"_id":"nanolog@0.1.1","_engineSupported":true,"_npmVersion":"1.1.0-beta-10","_nodeVersion":"v0.6.7","_defaultsLoaded":true,"dist":{"shasum":"b80b2c8ff15ee8e4fd75a25634b2a46f9a01d741","tarball":"https://registry.npmjs.org/nanolog/-/nanolog-0.1.1.tgz","integrity":"sha512-xUkvkFDaauBBVOosGeitenp/EhNfpAYavbM13X5PfkpLEiNhtaou9v+0tehK0veBG5TVAevuXEeE61NmMcJCcQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDW2tL8l+6VJUZUmoDGLcH0FjuEL7RSSJ/bgZzisnn8bgIgZvyIXBriQUX9z9gSIfbhXxiUcWIh3DIlrCaK5mObl48="}]},"maintainers":[{"name":"wvl","email":"wayne@larsen.st"}]}},"readme":"Sigh, yes, another logging module.\n\nThe goals:\n\n  * Flexible -- format of log entry, where to log\n  * Simple -- Simple api\n  * Multiple output transports, with different configs and log levels\n\n### Usage\n\nThe default logger is set to log to stdout, with coloured logs\n\n```js\nvar log = require('nanolog');\nlog.info(\"My Message\")\nlog.error(\"Log my error\")\nlog.debug(\"Debug info\", {msg: 'All params are output'})\n```\n\nYou can set the default output level, and even the default log levels:\n\n```js\nlog.set({levels: {bad: 0, good: 1, boring: 2}, level: 'good'})\nlog.bad(\"Uh Oh\")\nlog.boring(\"Not logged\")\n```\n\n\nnanolog uses a stack of output functions to write our logs. You can\nset your own with 'to'. You can also set a log level for each output\nfunction that will override the default:\n\n```js\nlog.to(log.out.stdout(), log.out.file({file: './log.txt', level: 'warn'}))\n```\n\nThe output functions use a simple substitution format that lets \nyou specify what you want your logs to look like:\n\n```js\nlog.to(log.out.stdout({format: \"nanolog: %message%\"}))\nfmt = \"%(white|bold)timestamp% [%(color)level%] %(color)message%\"\nlog.to(log.out.stdout({format: fmt})\n```\n\nThe logging functionality revolves around a 'LogEntry' object. This\nobject defines the attributes that can be written. You can easily \ncustomize the logging functionality by adding functions to this\nobject. `timestamp`, `datetime`, and `color` are all builtin log\nfunctions that you can use or override.\n\n```js\nlog.entry.upcaseMessage = function(entry) {\n  return entry.get('message').toUpperCase();\n}\nlog.to(log.out.stdout({format: \"%upcaseMessage%\"}))\nlog.info(\"hello, world\")\n// result:\nHELLO, WORLD\n```\n\nBy default, all operations work on the default logger that is returned\nfrom the `nanolog` module. You can create other loggers as well:\n\n```js\nvar log = require('nanolog');\nvar filelog = log.create('filelog');\nfilelog.to(log.out.file({file: './log.txt'}));\nfilelog.info(\"This goes to the log file\");\n````\n\nFinally, you can drill down and be specific about what gets output by\nusing the `module` feature.\n\n```js\nvar log = require('nanolog');\nlog.set({modules: {feature: 'debug', root: 'info'})\n\nvar featureLogger = log.module('feature');\nvar rootLogger = log.module('root');\n\nlog.info(\"You can set module level overrides on output level\");\nfeatureLogger.debug(\"This will be displayed\");\nrootLogger.debug(\"This will not be displayed\");\n```\n\n\nAPI\n===\n\n### set\n\nSet new options on the logger.\n\n*levels*: An object, keys are level name, value is the integer level.\n\n  Default:\n    {'panic': 0, 'error': 1, 'warn': 2, 'info': 3, 'debug': 4, 'trace':\n5}\n\n*level*: `string` level to log at, default: 'info'\n\n*modules*: An object providing custom log levels for modules:\n\n  Example:\n    {feature1: 'debug', noisyFeature: 'warn'}\n\n### attrs\n\n`attrs` is an object on the logger. It's keys are functions that can\nprovide custom data to the output function. By default, attrs is\nconfigured with a number of useful functions:\n\nThe entry object starts with the attributes provided by the log\nfunctions:\n\n  * message: The first parameter given to the log function.\n  * params: An array of any other parameters passed\n  * level: The level of the requested log function\n\nBy default attrs is configured with a number of useful functions:\n\n  * timestamp:\n  * datetime: provide a formatted datetime value\n  * inspect: outputs any additional parameters, using util.inspect\n  * color: The default color for the level.\n\nCustom attrs can be provided (or the defaults overriden). Example:\n\n```js\nlog.entry.upcaseMessage = function(entry) {\n  return entry.get('message').toUpperCase();\n}\n```\n\n### to <list of parameters that contain log function>\n\nSets the output stack:\n\n```js\nlog.to(log.out.stdout(), log.out.file({file: './log.txt', level:\n'warn'}))\n```\n\n\n### module\n\nReturns a logger object that is module specific. You can then set\nmodule specific logger levels (to turn up/down certain sections of\ncode).\n","maintainers":[{"name":"wvl","email":"wayne@larsen.st"}],"time":{"modified":"2022-06-20T20:14:42.054Z","created":"2011-12-05T02:00:48.420Z","0.1.0":"2011-12-05T02:00:49.829Z","0.1.1":"2012-01-18T03:53:20.474Z"},"author":{"name":"Wayne Larsen","email":"wayne@larsen.st"},"repository":{"url":"https://github.com/wvl/nanolog.git"}}