[英]logging in node.js using debug library
I'm currently using debug library . 我目前正在使用调试库 。
Is there a way I can save the output texts from debug library to a file for log like Winston. 有没有一种方法可以将调试库中的输出文本保存到Winston之类的日志文件中。
For example... pseudo code... 例如...伪代码...
var debug = require('debug')('test');
// debug.bind('test.log'); // <-- something like this..
debug('hello world');
So.. 'hello world' should be in a test.log 因此,“ hello world”应该在test.log中
I found this site where the author uses Winston. 我在作者使用Winston的地方找到了这个网站。
var winston = require('winston');
//log your output to a file also
winston.add(winston.transports.File, { filename: 'somefile.log' });
//log some outputs
winston.log('info', 'Hello distributed log files!');
winston.error('Who let the dogs out?!');
Source: http://devgigs.blogspot.kr/2014/01/mastering-nodejs-logging.html?m=1 来源: http : //devgigs.blogspot.kr/2014/01/mastering-nodejs-logging.html?m = 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.