process-winston

0.0.0 • Public • Published

process-winston Build Status

process-winston allows the configuration of a process wide winston instance that can be used by all modules. This allows the main module to configure a winston instance and all other modules to share one configuration.

Why?

Because modules want to log stuff.

How?

Setup process-winston as soon as possible in your main application like so:

var logger = require('process-winston').init(require('winston', {
  console: {
    level: 'warn',
    colorize: 'true'
  }
})).add('mylogger', {console: {level: 'info'}});

The second argument to process-winston's init method is the default logging information to apply to all loggers. All default options are deep-extended into the options passed when adding a logger. Modules find their loggers like so:

var log = require('process-winston').get('modulename');

and then they just use the logger.

Now if you want to see lots of logging from the module named modulename you'd change the initialization section in the main application to be this:

var pwinston = require('process-winston').init(require('winston', {
  console: {
    level: 'warn',
    colorize: 'true'
  }
})),
    logger = pwinston.add('mylogger', {console: {level: 'info''}});
pwinston.add('modulename', {console: {level: 'silly'}});

Readme

Keywords

none

Package Sidebar

Install

npm i process-winston

Weekly Downloads

0

Version

0.0.0

License

BSD

Last publish

Collaborators

  • nik9000