Closed martinzuern closed 7 years ago
I just tested this, and it seems to be working fine. Is it possible that you have your transport(s) on your winstonInstance
set not to log at the "warn" level?
Here's the code I used (with some transport options laid out as well):
app.use(expressWinston.errorLogger({
transports: [
new winston.transports.Console({}),
// new winston.transports.Console({level: 'warn'}), // also works
// new winston.transports.Console({level: 'error'}), // DOES NOT work (reproduces bug)
],
msg: '{{err.message}}',
level: function() {
return 'warn';
}
}));
Thanks for your quick response. You're right – sorry for bothering you with this issue.
No problem!
When using a function for the
level
option, nothing will be logged by the error logger. Please find a simple example attached: