Winston有多个日志文件? [英] Multiple log files with Winston?

查看:215
本文介绍了Winston有多个日志文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们想使用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有多个日志文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆