I happened to use bunyan to log the the data . I wanted the logs be printed with appropriate colors like errors in red , debug yellow .. etc; unfortunately I couldn't find anyways to do that . And now I would like to know if its possible with winston. Can I change the color of log data in winston ?
here is the code that I executed .
var logger = require("winston-color");
var winston = require('winston');
var util = require('util');
var logFilename = __dirname + '/logfile.log';
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)(),
new (winston.transports.File)({
filename: 'logfile.log',
timestamp:true
}),
new (winston.transports.File)({
name: 'error-log',
filename: 'error.log',
level: 'error'
}),
new (winston.transports.File)({
name: 'info-log',
filename: 'info.log',
level: 'info'
}),
]
});
logger.info('Hello Winston info!');
logger.debug('Hello Winston debug!');
logger.warn('Hello Winston warn!');
logger.info('Hello again distributed logs');
logger.error('error1');
logger.error('error2');
the output screen shot here
working code's output here here