我目前使用debug library。使用调试库登录node.js
有没有一种方法可以将输出文本从调试库保存到Winston等日志文件中。
例如...伪代码...
var debug = require('debug')('test');
// debug.bind('test.log'); // <-- something like this..
debug('hello world');
所以..“世界你好”应在test.log中
我目前使用debug library。使用调试库登录node.js
有没有一种方法可以将输出文本从调试库保存到Winston等日志文件中。
例如...伪代码...
var debug = require('debug')('test');
// debug.bind('test.log'); // <-- something like this..
debug('hello world');
所以..“世界你好”应在test.log中
我发现这个网站,在这里笔者采用温斯顿。
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?!');
来源:http://devgigs.blogspot.kr/2014/01/mastering-nodejs-logging.html?m=1
他们建议重定向像'$节点的输出app.js 2> output.txt' https://github.com/visionmedia/debug/issues/85或'$ DEBUG_FD = 3节点script.js 3> debug.log' https://github.com/visionmedia/debug/issues/146 – 2014-12-03 02:14:43