When using Bunyan, all my log levels use the same cyan color, like so:
Here is the Bunyan configuration we are using:
const bunyan = require('bunyan');
module.exports = bunyan.createLogger({name: 'cdt-api-server'});
My question is - how can I get Bunyan to use red or magenta for logging error information / stack traces? The problem is that "ERROR" in red characters is not enough to capture my attention - I'd like to have the whole stack in red or magenta.
Here is the Bunyan readme: https://github.com/trentm/node-bunyan
I only see "color" mentioned once.
Can we do something like this?
const bunyan = require('bunyan');
module.exports = bunyan.createLogger({
name: 'cdt-api-server',
streams: [
{
level: 'trace',
stream: process.stdout,
color: 'black',
},
{
level: 'debug',
stream: process.stdout,
color: 'blue',
},
{
level: 'info',
stream: process.stdout,
color: 'cyan',
},
{
level: 'error',
path: process.stderr,
color: 'red'
},
{
level: 'warn',
path: process.stderr,
color: 'magenta'
}
]
});