使用调试库登录node.js
我目前正在使用 是否有一种方法可以将调试库中的输出文本保存到类似Winston的日志文件中 例如。。。伪代码使用调试库登录node.js,node.js,debugging,winston,Node.js,Debugging,Winston,我目前正在使用 是否有一种方法可以将调试库中的输出文本保存到类似Winston的日志文件中 例如。。。伪代码 var debug = require('debug')('test'); // debug.bind('test.log'); // <-- something like this.. debug('hello world'); var debug=require('debug')('test'); //debug.bind('test.log');// 我找到了作者使用Win
var debug = require('debug')('test');
// debug.bind('test.log'); // <-- something like this..
debug('hello world');
var debug=require('debug')('test');
//debug.bind('test.log');// 我找到了作者使用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?!');
来源:谢谢你的回答。。但当我更新问题时。。我想用调试库而不是winston记录一些东西。。。可能吗?啊,抱歉我误解了你的问题。他们建议重定向输出,如$node app.js 2>output.txt
或$DEBUG\u FD=3 node script.js 3>DEBUG.log