问题描述
我们想使用Winston来登录Node.js.但是,我们无法弄清楚如何拥有两个日志文件:一个仅用于错误,另一个用于其他所有文件.
We'd like to use Winston for our logging in Node.js. But, we can't figure out how to have two log files: one for just errors, and one for everything else.
执行这种天真的方法是行不通的,但是:添加多个winston.transports.File
传输会产生错误.
Doing this the naive way doesn't work, however: adding multiple winston.transports.File
transports gives an error.
其他人也遇到了这个问题,虽然暗示着解决方案,但没有真正的答案.
有什么想法吗?
推荐答案
我刚刚发送了请求请求,该请求允许在一个记录器中使用多个文件传输. https://github.com/flatiron/winston/pull/149
I just sent a pull request that allows using multiple File transports in one logger.https://github.com/flatiron/winston/pull/149
它已经合并到熨斗/温斯顿中.
It is already merged into flatiron/winston.
您还可以使用我的分叉存储库: https://github.com/pdobrev/winston
You can also use my forked repo: https://github.com/pdobrev/winston
这篇关于Winston有多个日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!