bunyan-dev-friendly

2.0.0 • Public • Published

bunyan-dev-friendly dependencies Status

Switch off bunyan logging when NODE_ENV=development

Example

log.js:

var logger = require('bunyan-dev-friendly')
var log = logger(
  // bunyan.createLogger params
  {
    name: 'logger',
    streams: [
      {
        type: 'rotating-file',
          path: 'log-file.log',
          period: '1d',
          count: 3
      }
    ]
  }
)

...
log.info('hello world')

Now

$> NODE_ENV=development node log.js

results in console

hello world

and...

$> NODE_ENV=other node log.js

results in log-file.log:

{"name":"logger","hostname":"yourhost","pid":20111,"level":50,"msg":"hello world","time":"2016-10-23T21:03:05.918Z","v":0}

Dependents (0)

Package Sidebar

Install

npm i bunyan-dev-friendly

Weekly Downloads

0

Version

2.0.0

License

ISC

Last publish

Collaborators

  • mayashaddad