{
  "name": "winston",
  "description": "A multi-transport async logging library for Node.js",
  "version": "2.3.1",
  "author": {
    "name": "Charlie Robbins",
    "email": "charlie.robbins@gmail.com"
  },
  "maintainers": [
    {
      "name": "Jarrett Cruger",
      "email": "jcrugzz@gmail.com"
    },
    {
      "name": "Alberto Pose",
      "email": "albertopose@gmail.com"
    }
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/winstonjs/winston.git"
  },
  "keywords": [
    "winston",
    "logging",
    "sysadmin",
    "tools"
  ],
  "dependencies": {
    "async": "~1.0.0",
    "colors": "1.0.x",
    "cycle": "1.0.x",
    "eyes": "0.1.x",
    "isstream": "0.1.x",
    "stack-trace": "0.0.x"
  },
  "devDependencies": {
    "cross-spawn-async": "^2.0.0",
    "hock": "1.x.x",
    "std-mocks": "~1.0.0",
    "vows": "0.7.x"
  },
  "main": "./lib/winston",
  "scripts": {
    "test": "vows --spec --isolate"
  },
  "engines": {
    "node": ">= 0.10.0"
  },
  "license": "MIT",
  "readme": "# winston\n\n[![Join the chat at https://gitter.im/winstonjs/winston](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/winstonjs/winston?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n\n[![Version npm](https://img.shields.io/npm/v/winston.svg?style=flat-square)](https://www.npmjs.com/package/winston)[![npm Downloads](https://img.shields.io/npm/dm/winston.svg?style=flat-square)](https://www.npmjs.com/package/winston)[![Build Status](https://img.shields.io/travis/winstonjs/winston/master.svg?style=flat-square)](https://travis-ci.org/winstonjs/winston)[![Dependencies](https://img.shields.io/david/winstonjs/winston.svg?style=flat-square)](https://david-dm.org/winstonjs/winston)\n\n[![NPM](https://nodei.co/npm/winston.png?downloads=true&downloadRank=true)](https://nodei.co/npm/winston/)\n\nA multi-transport async logging library for node.js. <span style=\"font-size:28px; font-weight:bold;\">&quot;CHILL WINSTON! ... I put it in the logs.&quot;</span>\n\n## Motivation\nWinston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file.\n\nThere also seemed to be a lot of logging libraries out there that coupled their implementation of logging (i.e. how the logs are stored / indexed) to the API that they exposed to the programmer. This library aims to decouple those parts of the process to make it more flexible and extensible.\n\n## Installation\n\n```bashp\nnpm install winston\n```\n\n## Usage\nThere are two different ways to use winston: directly via the default logger, or by instantiating your own Logger. The former is merely intended to be a convenient shared logger to use throughout your application if you so choose.\n\n* [Logging](#logging)\n  * [Using the Default Logger](#using-the-default-logger)\n  * [Instantiating your own Logger](#instantiating-your-own-logger)\n  * [Logging with Metadata](#logging-with-metadata)\n  * [String interpolation](#string-interpolation)\n* [Transports](https://github.com/winstonjs/winston/blob/master/docs/transports.md)\n  * [Multiple transports of the same type](#multiple-transports-of-the-same-type)\n* [Profiling](#profiling)\n* [Streaming Logs](#streaming-logs)\n* [Querying Logs](#querying-logs)\n* [Exceptions](#exceptions)\n  * [Handling Uncaught Exceptions with winston](#handling-uncaught-exceptions-with-winston)\n  * [To Exit or Not to Exit](#to-exit-or-not-to-exit)\n* [Logging Levels](#logging-levels)\n  * [Using Logging Levels](#using-logging-levels)\n  * [Using Custom Logging Levels](#using-custom-logging-levels)\n* [Further Reading](#further-reading)\n  * [Events and Callbacks in Winston](#events-and-callbacks-in-winston)\n  * [Working with multiple Loggers in winston](#working-with-multiple-loggers-in-winston)\n  * [Using winston in a CLI tool](#using-winston-in-a-cli-tool)\n  * [Filters and Rewriters](#filters-and-rewriters)\n  * [Adding Custom Transports](#adding-custom-transports)\n* [Installation](#installation)\n* [Run Tests](#run-tests)\n\n\n## Logging\n\nLogging levels in `winston` conform to the severity ordering specified by [RFC5424](https://tools.ietf.org/html/rfc5424): _severity of all levels is assumed to be numerically **ascending** from most important to least important._\n\n### Using the Default Logger\nThe default logger is accessible through the winston module directly. Any method that you could call on an instance of a logger is available on the default logger:\n\n``` js\n  var winston = require('winston');\n\n  winston.log('info', 'Hello distributed log files!');\n  winston.info('Hello again distributed logs');\n\n  winston.level = 'debug';\n  winston.log('debug', 'Now my debug messages are written to console!');\n```\n\nBy default, only the Console transport is set on the default logger. You can add or remove transports via the add() and remove() methods:\n\n``` js\n  winston.add(winston.transports.File, { filename: 'somefile.log' });\n  winston.remove(winston.transports.Console);\n```\n\nOr do it with one call to configure():\n\n``` js\n  winston.configure({\n    transports: [\n      new (winston.transports.File)({ filename: 'somefile.log' })\n    ]\n  });\n```\n\nFor more documentation about working with each individual transport supported by Winston see the [Winston Transports](docs/transports.md) document.\n\n### Instantiating your own Logger\nIf you would prefer to manage the object lifetime of loggers you are free to instantiate them yourself:\n\n``` js\n  var logger = new (winston.Logger)({\n    transports: [\n      new (winston.transports.Console)(),\n      new (winston.transports.File)({ filename: 'somefile.log' })\n    ]\n  });\n```\n\nYou can work with this logger in the same way that you work with the default logger:\n\n``` js\n  //\n  // Logging\n  //\n  logger.log('info', 'Hello distributed log files!');\n  logger.info('Hello again distributed logs');\n\n  //\n  // Adding / Removing Transports\n  //   (Yes It's chainable)\n  //\n  logger\n    .add(winston.transports.File)\n    .remove(winston.transports.Console);\n```\n\nYou can also wholesale reconfigure a `winston.Logger` instance using the `configure` method:\n\n``` js\n  var logger = new winston.Logger({\n    level: 'info',\n    transports: [\n      new (winston.transports.Console)(),\n      new (winston.transports.File)({ filename: 'somefile.log' })\n    ]\n  });\n\n  //\n  // Replaces the previous transports with those in the\n  // new configuration wholesale.\n  //\n  logger.configure({\n    level: 'verbose',\n    transports: [\n      new (require('winston-daily-rotate-file'))(opts)\n    ]\n  });\n```\n\n\n### Logging with Metadata\nIn addition to logging string messages, winston will also optionally log additional JSON metadata objects. Adding metadata is simple:\n\n``` js\n  winston.log('info', 'Test Log Message', { anything: 'This is metadata' });\n```\n\nThe way these objects are stored varies from transport to transport (to best support the storage mechanisms offered). Here's a quick summary of how each transports handles metadata:\n\n1. __Console:__ Logged via util.inspect(meta)\n2. __File:__ Logged via util.inspect(meta)\n\n## Multiple transports of the same type\n\nIt is possible to use multiple transports of the same type e.g. `winston.transports.File` by passing in a custom `name` when you construct the transport.\n\n``` js\nvar logger = new (winston.Logger)({\n  transports: [\n    new (winston.transports.File)({\n      name: 'info-file',\n      filename: 'filelog-info.log',\n      level: 'info'\n    }),\n    new (winston.transports.File)({\n      name: 'error-file',\n      filename: 'filelog-error.log',\n      level: 'error'\n    })\n  ]\n});\n```\n\nIf you later want to remove one of these transports you can do so by using the string name. e.g.:\n\n``` js\nlogger.remove('info-file');\n```\n\nIn this example one could also remove by passing in the instance of the Transport itself. e.g. this is equivalent to the string example above;\n\n``` js\n// Notice it was first in the Array above\nvar infoFile = logger.transports[0];\nlogger.remove(infoFile);\n```\n\n## Profiling\nIn addition to logging messages and metadata, winston also has a simple profiling mechanism implemented for any logger:\n\n``` js\n  //\n  // Start profile of 'test'\n  // Remark: Consider using Date.now() with async operations\n  //\n  winston.profile('test');\n\n  setTimeout(function () {\n    //\n    // Stop profile of 'test'. Logging will now take place:\n    //   \"17 Jan 21:00:00 - info: test duration=1000ms\"\n    //\n    winston.profile('test');\n  }, 1000);\n```\n\nAll profile messages are set to the 'info' by default and both message and metadata are optional There are no plans in the Roadmap to make this configurable, but I'm open to suggestions / issues.\n\n### String interpolation\nThe `log` method provides the same string interpolation methods like [`util.format`][10].\n\nThis allows for the following log messages.\n``` js\nlogger.log('info', 'test message %s', 'my string');\n// info: test message my string\n\nlogger.log('info', 'test message %d', 123);\n// info: test message 123\n\nlogger.log('info', 'test message %j', {number: 123}, {});\n// info: test message {\"number\":123}\n// meta = {}\n\nlogger.log('info', 'test message %s, %s', 'first', 'second', {number: 123});\n// info: test message first, second\n// meta = {number: 123}\n\nlogger.log('info', 'test message', 'first', 'second', {number: 123});\n// info: test message first second\n// meta = {number: 123}\n\nlogger.log('info', 'test message %s, %s', 'first', 'second', {number: 123}, function(){});\n// info: test message first, second\n// meta = {number: 123}\n// callback = function(){}\n\nlogger.log('info', 'test message', 'first', 'second', {number: 123}, function(){});\n// info: test message first second\n// meta = {number: 123}\n// callback = function(){}\n```\n\n\n\n\n\n## Querying Logs\nWinston supports querying of logs with Loggly-like options. [See Loggly Search API](https://www.loggly.com/docs/api-retrieving-data/).\nSpecifically: `File`, `Couchdb`, `Redis`, `Loggly`, `Nssocket`, and `Http`.\n\n``` js\n  var options = {\n    from: new Date - 24 * 60 * 60 * 1000,\n    until: new Date,\n    limit: 10,\n    start: 0,\n    order: 'desc',\n    fields: ['message']\n  };\n\n  //\n  // Find items logged between today and yesterday.\n  //\n  winston.query(options, function (err, results) {\n    if (err) {\n      throw err;\n    }\n\n    console.log(results);\n  });\n```\n\n## Streaming Logs\nStreaming allows you to stream your logs back from your chosen transport.\n\n``` js\n  //\n  // Start at the end.\n  //\n  winston.stream({ start: -1 }).on('log', function(log) {\n    console.log(log);\n  });\n```\n\n## Exceptions\n\n### Handling Uncaught Exceptions with winston\n\nWith `winston`, it is possible to catch and log `uncaughtException` events from your process. There are two distinct ways of enabling this functionality either through the default winston logger or your own logger instance.\n\nIf you want to use this feature with the default logger simply call `.handleExceptions()` with a transport instance.\n\n``` js\n  //\n  // You can add a separate exception logger by passing it to `.handleExceptions`\n  //\n  winston.handleExceptions(new winston.transports.File({ filename: 'path/to/exceptions.log' }))\n\n  //\n  // Alternatively you can set `.handleExceptions` to true when adding transports to winston.\n  // You can use the `.humanReadableUnhandledException` option to get more readable exceptions.\n  //\n  winston.add(winston.transports.File, {\n    filename: 'path/to/all-logs.log',\n    handleExceptions: true,\n    humanReadableUnhandledException: true\n  });\n  \n  //\n  // Exceptions can also be handled by multiple transports.\n  //\n  winston.handleExceptions([ transport1, transport2, ... ]);\n```\n\n### To Exit or Not to Exit\n\nBy default, winston will exit after logging an uncaughtException. if this is not the behavior you want,\nset `exitOnError = false`\n\n``` js\n  var logger = new (winston.Logger)({ exitOnError: false });\n\n  //\n  // or, like this:\n  //\n  logger.exitOnError = false;\n```\n\nWhen working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport.\n\nExample 1\n\n``` js\n  var logger = new (winston.Logger)({\n    transports: [\n      new winston.transports.File({ filename: 'path/to/all-logs.log' })\n    ],\n    exceptionHandlers: [\n      new winston.transports.File({ filename: 'path/to/exceptions.log' })\n    ]\n  });\n```\n\nExample 2\n\n``` js\nvar logger = new winston.Logger({\n  transports: [\n    new winston.transports.Console({\n      handleExceptions: true,\n      json: true\n    })\n  ],\n  exitOnError: false\n});\n```\n\nThe `exitOnError` option can also be a function to prevent exit on only certain types of errors:\n\n``` js\n  function ignoreEpipe(err) {\n    return err.code !== 'EPIPE';\n  }\n\n  var logger = new (winston.Logger)({ exitOnError: ignoreEpipe });\n\n  //\n  // or, like this:\n  //\n  logger.exitOnError = ignoreEpipe;\n```\n\n## Logging Levels\n\nEach `level` is given a specific integer priority. The higher the priority the more important the message is considered to be, and the lower the corresponding integer priority.  For example, `npm` logging levels are prioritized from 0 to 5 (highest to lowest):\n\n``` js\n{ error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }\n```\n\nSimilarly, as specified exactly in RFC5424 the `syslog` levels are prioritized from 0 to 7 (highest to lowest).\n\n```js\n{ emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }\n```\n\nIf you do not explicitly define the levels that `winston` should use the `npm` levels above will be used.\n\n### Using Logging Levels\nSetting the level for your logging message can be accomplished in one of two ways. You can pass a string representing the logging level to the log() method or use the level specified methods defined on every winston Logger.\n\n``` js\n  //\n  // Any logger instance\n  //\n  logger.log('silly', \"127.0.0.1 - there's no place like home\");\n  logger.log('debug', \"127.0.0.1 - there's no place like home\");\n  logger.log('verbose', \"127.0.0.1 - there's no place like home\");\n  logger.log('info', \"127.0.0.1 - there's no place like home\");\n  logger.log('warn', \"127.0.0.1 - there's no place like home\");\n  logger.log('error', \"127.0.0.1 - there's no place like home\");\n  logger.info(\"127.0.0.1 - there's no place like home\");\n  logger.warn(\"127.0.0.1 - there's no place like home\");\n  logger.error(\"127.0.0.1 - there's no place like home\");\n\n  //\n  // Default logger\n  //\n  winston.log('info', \"127.0.0.1 - there's no place like home\");\n  winston.info(\"127.0.0.1 - there's no place like home\");\n```\n\n`winston` allows you to define a `level` property on each transport which specifies the **maximum** level of messages that a transport should log. For example, using the `npm` levels you could log only `error` messages to the console and everything `info` and below to a file (which includes `error` messages):\n\n``` js\n  var logger = new (winston.Logger)({\n    transports: [\n      new (winston.transports.Console)({ level: 'error' }),\n      new (winston.transports.File)({\n        filename: 'somefile.log',\n        level: 'info'\n      })\n    ]\n  });\n```\n\nYou may also dynamically change the log level of a transport:\n\n``` js\n  var logger = new (winston.Logger)({\n    transports: [\n      new (winston.transports.Console)({ level: 'warn' }),\n      new (winston.transports.File)({ filename: 'somefile.log', level: 'error' })\n    ]\n  });\n  logger.debug(\"Will not be logged in either transport!\");\n  logger.transports.console.level = 'debug';\n  logger.transports.file.level = 'verbose';\n  logger.verbose(\"Will be logged in both transports!\");\n```\n\nAs of 0.2.0, winston supports customizable logging levels, defaulting to [npm][0] style logging levels. Changing logging levels is easy:\n\n``` js\n  //\n  // Change levels on the default winston logger\n  //\n  winston.setLevels(winston.config.syslog.levels);\n\n  //\n  // Change levels on an instance of a logger\n  //\n  logger.setLevels(winston.config.syslog.levels);\n```\n\nCalling `.setLevels` on a logger will remove all of the previous helper methods for the old levels and define helper methods for the new levels. Thus, you should be careful about the logging statements you use when changing levels. For example, if you ran this code after changing to the syslog levels:\n\n``` js\n  //\n  // Logger does not have 'silly' defined since that level is not in the syslog levels\n  //\n  logger.silly('some silly message');\n```\n\n### Using Custom Logging Levels\nIn addition to the predefined `npm` and `syslog` levels available in Winston, you can also choose to define your own:\n\n``` js\n  var myCustomLevels = {\n    levels: {\n      foo: 0,\n      bar: 1,\n      baz: 2,\n      foobar: 3\n    },\n    colors: {\n      foo: 'blue',\n      bar: 'green',\n      baz: 'yellow',\n      foobar: 'red'\n    }\n  };\n\n  var customLevelLogger = new (winston.Logger)({ levels: myCustomLevels.levels });\n  customLevelLogger.foobar('some foobar level-ed message');\n```\n\nAlthough there is slight repetition in this data structure, it enables simple encapsulation if you do not want to have colors. If you do wish to have colors, in addition to passing the levels to the Logger itself, you must make winston aware of them:\n\n``` js\n  //\n  // Make winston aware of these colors\n  //\n  winston.addColors(myCustomLevels.colors);\n```\n\nThis enables transports with the 'colorize' option set to appropriately color the output of custom levels.\n\n## Further Reading\n\n### Events and Callbacks in Winston\nEach instance of winston.Logger is also an instance of an [EventEmitter][1]. A log event will be raised each time a transport successfully logs a message:\n\n``` js\n  logger.on('logging', function (transport, level, msg, meta) {\n    // [msg] and [meta] have now been logged at [level] to [transport]\n  });\n\n  logger.info('CHILL WINSTON!', { seriously: true });\n```\n\nIt is also worth mentioning that the logger also emits an 'error' event which you should handle or suppress if you don't want unhandled exceptions:\n\n``` js\n  //\n  // Handle errors\n  //\n  logger.on('error', function (err) { /* Do Something */ });\n\n  //\n  // Or just suppress them.\n  //\n  logger.emitErrs = false;\n```\n\nEvery logging method described in the previous section also takes an optional callback which will be called only when all of the transports have logged the specified message.\n\n``` js\n  logger.info('CHILL WINSTON!', { seriously: true }, function (err, level, msg, meta) {\n    // [msg] and [meta] have now been logged at [level] to **every** transport.\n  });\n```\n\n### Working with multiple Loggers in winston\n\nOften in larger, more complex applications it is necessary to have multiple logger instances with different settings. Each logger is responsible for a different feature area (or category). This is exposed in `winston` in two ways: through `winston.loggers` and instances of `winston.Container`. In fact, `winston.loggers` is just a predefined instance of `winston.Container`:\n\n``` js\n  var winston = require('winston');\n\n  //\n  // Configure the logger for `category1`\n  //\n  winston.loggers.add('category1', {\n    console: {\n      level: 'silly',\n      colorize: true,\n      label: 'category one'\n    },\n    file: {\n      filename: '/path/to/some/file'\n    }\n  });\n\n  //\n  // Configure the logger for `category2`\n  //\n  winston.loggers.add('category2', {\n    couchdb: {\n      host: '127.0.0.1',\n      port: 5984\n    }\n  });\n```\n\nNow that your loggers are setup you can require winston _in any file in your application_ and access these pre-configured loggers:\n\n``` js\n  var winston = require('winston');\n\n  //\n  // Grab your preconfigured logger\n  //\n  var category1 = winston.loggers.get('category1');\n\n  category1.info('logging from your IoC container-based logger');\n```\n\nIf you prefer to manage the `Container` yourself you can simply instantiate one:\n\n``` js\n  var winston = require('winston'),\n      container = new winston.Container();\n\n  container.add('category1', {\n    console: {\n      level: 'silly',\n      colorize: true\n    },\n    file: {\n      filename: '/path/to/some/file'\n    }\n  });\n```\n\n### Sharing transports between Loggers in winston\n\n``` js\n  var winston = require('winston');\n\n  //\n  // Setup transports to be shared across all loggers\n  // in three ways:\n  //\n  // 1. By setting it on the default Container\n  // 2. By passing `transports` into the constructor function of winston.Container\n  // 3. By passing `transports` into the `.get()` or `.add()` methods\n  //\n\n  //\n  // 1. By setting it on the default Container\n  //\n  winston.loggers.options.transports = [\n    // Setup your shared transports here\n  ];\n\n  //\n  // 2. By passing `transports` into the constructor function of winston.Container\n  //\n  var container = new winston.Container({\n    transports: [\n      // Setup your shared transports here\n    ]\n  });\n\n  //\n  // 3. By passing `transports` into the `.get()` or `.add()` methods\n  //\n  winston.loggers.add('some-category', {\n    transports: [\n      // Setup your shared transports here\n    ]\n  });\n\n  container.add('some-category', {\n    transports: [\n      // Setup your shared transports here\n    ]\n  });\n```\n\n### Using winston in a CLI tool\nA common use-case for logging is output to a CLI tool. Winston has a special helper method which will pretty print output from your CLI tool. Here's an example from the [require-analyzer][2] written by [Nodejitsu][3]:\n\n```\n  info:   require-analyzer starting in /Users/Charlie/Nodejitsu/require-analyzer\n  info:   Found existing dependencies\n  data:   {\n  data:     colors: '0.x.x',\n  data:     eyes: '0.1.x',\n  data:     findit: '0.0.x',\n  data:     npm: '1.0.x',\n  data:     optimist: '0.2.x',\n  data:     semver: '1.0.x',\n  data:     winston: '0.2.x'\n  data:   }\n  info:   Analyzing dependencies...\n  info:   Done analyzing raw dependencies\n  info:   Retrieved packages from npm\n  warn:   No additional dependencies found\n```\n\nConfiguring output for this style is easy, just use the `.cli()` method on `winston` or an instance of `winston.Logger`:\n\n``` js\n  var winston = require('winston');\n\n  //\n  // Configure CLI output on the default logger\n  //\n  winston.cli();\n\n  //\n  // Configure CLI on an instance of winston.Logger\n  //\n  var logger = new winston.Logger({\n    transports: [\n      new (winston.transports.Console)()\n    ]\n  });\n\n  logger.cli();\n```\n\n### Filters and Rewriters\nFilters allow modifying the contents of **log messages**, and Rewriters allow modifying the contents of **log meta** e.g. to mask data that should not appear in logs.\n\nBoth filters and rewriters are simple Arrays of functions which can be provided when creating a `new winston.Logger(options)`. e.g.:\n\n``` js\nvar logger = new winston.Logger({\n  rewriters: [function (level, msg, meta) { /* etc etc */ }],\n  filters:   [function (level, msg, meta) { /* etc etc */ }]\n})\n```\n\nLike any Array they can also be modified at runtime with no adverse side-effects to the `winston` internals.\n\n``` js\nlogger.filters.push(function(level, msg, meta) {\n  return meta.production\n    ? maskCardNumbers(msg)\n    : msg;\n});\n\nlogger.info('transaction with card number 123456789012345 successful.');\n```\n\nThis may result in this output:\n\n```\ninfo: transaction with card number 123456****2345 successful.\n```\n\nWhere as for rewriters, if you wanted to sanitize the `creditCard` field of your `meta` you could:\n\n``` js\nlogger.rewriters.push(function(level, msg, meta) {\n  if (meta.creditCard) {\n    meta.creditCard = maskCardNumbers(meta.creditCard)\n  }\n\n  return meta;\n});\n\nlogger.info('transaction ok', { creditCard: 123456789012345 });\n```\n\nwhich may result in this output:\n\n```\ninfo: transaction ok creditCard=123456****2345\n```\n\nSee [log-filter-test.js](./test/log-filter-test.js), where card number masking is implemented as an example along with [log-rewriter-test.js](./test/log-rewriter-test.js)\n\n## Adding Custom Transports\nAdding a custom transport is actually pretty easy. All you need to do is accept a couple of options, set a name, implement a log() method, and add it to the set of transports exposed by winston.\n\n``` js\n  var util = require('util'),\n      winston = require('winston');\n\n  var CustomLogger = winston.transports.CustomLogger = function (options) {\n    //\n    // Name this logger\n    //\n    this.name = 'customLogger';\n\n    //\n    // Set the level from your options\n    //\n    this.level = options.level || 'info';\n\n    //\n    // Configure your storage backing as you see fit\n    //\n  };\n\n  //\n  // Inherit from `winston.Transport` so you can take advantage\n  // of the base functionality and `.handleExceptions()`.\n  //\n  util.inherits(CustomLogger, winston.Transport);\n\n  CustomLogger.prototype.log = function (level, msg, meta, callback) {\n    //\n    // Store this message and metadata, maybe use some custom logic\n    // then callback indicating success.\n    //\n    callback(null, true);\n  };\n```\n\n### Custom Log Format\nTo specify custom log format you should set formatter function for transport. Currently supported transports are: Console, File, Memory.\nOptions object will be passed to the format function. It's general properties are: timestamp, level, message, meta. Depending on the transport type may be additional properties.\n\n``` js\nvar logger = new (winston.Logger)({\n  transports: [\n    new (winston.transports.Console)({\n      timestamp: function() {\n        return Date.now();\n      },\n      formatter: function(options) {\n        // Return string will be passed to logger.\n        return options.timestamp() +' '+ options.level.toUpperCase() +' '+ (options.message ? options.message : '') +\n          (options.meta && Object.keys(options.meta).length ? '\\n\\t'+ JSON.stringify(options.meta) : '' );\n      }\n    })\n  ]\n});\nlogger.info('Data to log.');\n```\n\n### Inspirations\n1. [npm][0]\n2. [log.js][4]\n3. [socket.io][5]\n4. [node-rlog][6]\n5. [BigBrother][7]\n6. [Loggly][8]\n\n## Installation\n\n### Installing npm (node package manager)\n```\n  curl http://npmjs.org/install.sh | sh\n```\n\n### Installing winston\n```\n  [sudo] npm install winston\n```\n\n## Run Tests\nAll of the winston tests are written in [vows][9], and designed to be run with npm.\n\n``` bash\n  $ npm test\n```\n\n#### Author: [Charlie Robbins](http://twitter.com/indexzero)\n#### Contributors: [Matthew Bergman](http://github.com/fotoverite), [Marak Squires](http://github.com/marak)\n\n[0]: https://github.com/npm/npmlog/blob/master/log.js\n[1]: http://nodejs.org/docs/v0.3.5/api/events.html#events.EventEmitter\n[2]: http://github.com/nodejitsu/require-analyzer\n[3]: http://nodejitsu.com\n[4]: https://github.com/visionmedia/log.js\n[5]: http://socket.io\n[6]: https://github.com/jbrisbin/node-rlog\n[7]: https://github.com/feisty/BigBrother\n[8]: http://loggly.com\n[9]: http://vowsjs.org\n[10]: http://nodejs.org/api/util.html#util_util_format_format\n[14]: http://nodejs.org/api/stream.html#stream_class_stream_writable\n[16]: https://github.com/indexzero/winston-mongodb\n[17]: https://github.com/indexzero/winston-riak\n[18]: https://github.com/appsattic/winston-simpledb\n[19]: https://github.com/wavded/winston-mail\n[21]: https://github.com/jesseditson/winston-sns\n[22]: https://github.com/flite/winston-graylog2\n[23]: https://github.com/kenperkins/winston-papertrail\n[24]: https://github.com/jorgebay/winston-cassandra\n[25]: https://github.com/jesseditson/winston-sns\n[26]: https://github.com/inspiredjw/winston-dynamodb/\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/winstonjs/winston/issues"
  },
  "homepage": "https://github.com/winstonjs/winston",
  "_id": "winston@2.3.1",
  "_shasum": "0b48420d978c01804cf0230b648861598225a119",
  "_from": "winston@^2.3.0",
  "_resolved": "https://registry.npmjs.org/winston/-/winston-2.3.1.tgz"
}
