node.js - 使用 NodeJs 进行高级日志记录:在 winston@3.0.0 中删除了 { emitErrs }
问题描述
我创建了这个函数来登录到一个详细级别设置为 info 的文件,每个文件最多 5 个文件和 5 MB,并且在终端中有一个完整的完整日志(详细级别调试),但不同的级别应该使用不同的颜色。
private initialize(): void {
var winston = require('winston');
winston.emitErrs = true;
var logger = new winston.Logger({
transports: [
new winston.transports.File({
level: 'info',
filename: './logs/all-logs.log',
handleExceptions: true,
json: true,
maxsize: 5242880, //5MB
maxFiles: 5,
colorize: false
}),
new winston.transports.Console({
level: 'debug',
handleExceptions: true,
json: false,
colorize: true
})
],
exitOnError: false
});
module.exports = logger;
module.exports.stream = {
write: function(message : any, encoding : any){
logger.info(message);
}
};
}
但是启动应用程序时出现此错误。
发生意外错误错误:在 winston@3.0.0 中删除了 { emitErrs }。
解决方案
推荐阅读
- assembly - 通过 x86 程序集更改位图
- php - 如何在 PHPUnit 中的 tearDown() 上正确删除 sqlite DB?
- c - C中的线程只是停止执行?
- python - Selenium 无头不适用于自定义配置文件选择
- javascript - 如何使用 jQuery 在警报框中获取范围滑块值?
- r - 如何找到每行中特定列的最大值和最小值
- c# - 具有自定义类的数据绑定 ListView
- excel - Excel VBA 测试或获取硬件加速设置并禁用 Windows 动画设置
- r - 从光栅图包到 ggplot2
- ios - 如何修复 Swift Playground 中的“无法查找符号”错误