I added this question on SO
http://stackoverflow.com/questions/35002880/bunyan-duplicate-logging-in-node-js-module
for some reason in multiple projects I having some duplicate log entries and I don't know why and haven't seen this problem before, but I don't believe I am on a new version of Bunyan and I doubt it's a problem with the Bunyan module. Please see SO question for details.
Any idea on why I might be seeing this, given my simple Bunyan configuration?
Thanks!
Well to answer one of your questions on the SO post about log levels. The log level is a minimum log level not an exclusive log level. If you have a stream configured for 'info', you will get all INFO logs and anything _more_ severe ( WARN, ERROR, etc)
As for your particular case double log case, the error configuration WOULD double log in the terminal if you logged with an error level log.
// test.js
var bunyan = require('bunyan')
var logger = bunyan.createLogger({
name: 'test',
streams: [
{
level: 'info',
stream: process.stdout
},
{
level: 'error',
stream: process.stderr
}
]
})
logger.error('hello!')
Would output:
$ node test.js
{"name":"test","hostname":"<hostname>","pid":<pid>,"level":50,"msg":"hello!","time":"2016-01-29T23:00:00.843Z","v":0}
{"name":"test","hostname":"<hostname>","pid":<pid>,"level":50,"msg":"hello!","time":"2016-01-29T23:00:00.843Z","v":0}
Hope this helps!
@rooftopsparrow Thanks for answering!
Most helpful comment
Well to answer one of your questions on the SO post about log levels. The log level is a minimum log level not an exclusive log level. If you have a stream configured for 'info', you will get all INFO logs and anything _more_ severe ( WARN, ERROR, etc)
As for your particular case double log case, the error configuration WOULD double log in the terminal if you logged with an error level log.
Would output:
Hope this helps!