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
Sorry, I know this is a bit of an old question.
What I do is a bit ugly, but allows me to keep using Jest's --silent
option normally. I just set Winston's silent
to process.argv.indexOf("--silent") >= 0
. For example:
const logger = new winston.Logger({
…,
transports: [
new winston.transports.Console({
…,
silent: process.argv.indexOf("--silent") >= 0,
}),
],
});