Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you add multiple levels to a single transport in Winston?

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'
});
like image 300
Allen Hartwig Avatar asked Aug 27 '13 16:08

Allen Hartwig


1 Answers

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.

like image 169
Allen Hartwig Avatar answered Sep 26 '22 04:09

Allen Hartwig