I have defined the logger.js as below:
var bunyan = require('bunyan');
var bunyanOpts = {
name: 'my-api',
streams: [
{
level: 'info',
path: 'logs/mylogs.log'
}
]
};
Using this I am only able to print info level logs , is there a way I can print Debug, trace, warn, error in the same file?
The level
property of a stream configuration sets the minimum level for that particular log stream. In your case, only messages with a level of info
or higher will be logged to the logfile.
If you want it to log messages with lower levels (trace
being the lowest), you can change the minimum level in the configuration:
var bunyanOpts = {
name : 'my-api',
streams : [{
level : 'trace',
path : 'logs/mylogs.log'
}]
};