I have implemented Winston to log my nodejs app. Currently I am writing the log to log files using the "DailyRotateFile" transport of Winston, and outputting the log data to the console.
I want to add an additional transport that emits the log message to a socket so that I can output it to the web interface I have created using Express, through socket.io.
This is the current way I have set up Winston:
var logger = new winston.Logger({
transports: [
new winston.transports.DailyRotateFile({
level: 'info',
filename: './Logs/Humuorkanalen',
datePattern: '.yyyy-MM-dd.log',
handleExceptions: true,
json: true,
maxsize: 5242880, // 5MB
maxFiles: 5,
colorize: false
}),
new winston.transports.Console({
level: 'debug',
handleExceptions: true,
json: false,
colorize: true
})
],
exitOnError: false
})
I have never used Winston before, and I have read the documentation, but I have not managed how to understand how I can achieve this. I would very much appreciate some suggestions as to achieve this. TIA!
Aucun commentaire:
Enregistrer un commentaire