在WINSTON @ 3中使用多个日志记录级别和传输器时,仅将特定级别的日志记录到各个文件中

时间:2020-06-04 09:10:04

标签: javascript winston

我尝试仅将特定日志记录到各自的文件中,但未能做到这一点,我尝试了在堆栈溢出时共享的多个选项,但它们都不起作用。主要是此链接但不起作用Logging individual level

以下是我想做的例子

logger.error("logging error text") -> Should go only into   log-error file
logger.warn("logging warn text") -> Should go only   into   log-warn file
logger.info("logging info text") -> Should go only   into   log-info file
logger.debug("logging debug text") -> Should go only into   log-debug file

现在正在发生的事情

logger.error("logging error text") -> Going into multiple file-> log-error file, log-warn file, 
log-info file, log-debug file
logger.warn("logging warn text") ->   Going into multiple file-> log-warn file,log-debug file, log- 
debug file
logger.info("logging info text") ->   Going into multiple file-> log-info file , log-debug file
logger.debug("logging debug text") -> Going into multiple file-> log-debug file

0 个答案:

没有答案