2.0.0 • Published 8 years ago
bunyan-dev-friendly v2.0.0
bunyan-dev-friendly
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}