在我的节点应用程序中,我使用 winston 模块来存储我的应用程序日志。我尝试将日志存储在不同的级别以及不同的文件中。在这种情况下,我收到错误为“错误:传输已附加:文件” .
我的代码
var winston=require('winston');
winston.add(winston.transports.File, { filename: './logfile.log',level:'error' });
winston.add(winston.transports.File, { filename: './logfile1.log',level:'warn' });
winston.add(winston.transports.File, { filename: './logfile2.log',level:'debug'});
winston.log('error', 'Error message!');//this should go to logfile.log
winston.log('warn', 'Warning message!');//this should go to logfile1.log
winston.log('debug', 'Debug message!');//this should go to logfile2.log