I try to add custom log levels to winston. This is the code for the logger:
const write = new (winston.Logger)({
transports: [
new (winston.transports.DailyRotateFile)({
filename: `${logDir}/%DATE%-log`,
timestamp: tsFormat,
datePattern: 'D-M-YYYY',
prepend: true,
zippedArchive:true,
}),
]
});
I have tried to add custom log levels, but I continue to see all logs in my log file.
This is my code for the custom log levels:
var levels = {
levels: {
info: 0,
debug: 1,
warning: 2,
error: 3
}
};
And then I added this line of code for transport:
levels: levels.levels
And this in my transport:
level: "error"
But I also keep seeing logs of info. Anyone can help me out with this? Thanks