我目前使用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