How does one tell Winston to log multiple levels to a single transport? For example, if you want to log both info
and error
level items to the console, how would you accomplish this? Specifying info
does not log all levels that are info level and more critical, it just logs info
. Passing an array of levels to the level
property does nothing.
winston.add(winston.transports.Console, {
colorize: true,
level: 'info'
});
or
winston.add(winstonMongo, {
safe: false,
db: 'logs',
collection: 'api',
level: 'info'
});
Specifying the info
level does include all levels that are more severe (eg: warn
, error
, debug
). Likewise, specifying warn
includes the warn
level, plus the more severe error
level.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With