Can Winston logging be selectively disabled when executing unit tests of a node module?
Ideally, I\'d like to have logging for informational and debug purposes when the
Winston transports have a silent
property that you can set, which is probably a little nicer than removing the entire transport.
I add a name to the transports to make is a little easier like this:
var logger = new winston.Logger();
logger.add(winston.transports.Console, {
name: 'console.info',
colorize: true,
showLevel: true,
formatter: consoleFormatter,
})
Then in the test or set-up I can selectively turn logging on and off with:
logger.transports['console.info'].silent = true // turns off
logger.transports['console.info'].silent = false // logging back on