Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用调试库登录node.js_Node.js_Debugging_Winston - Fatal编程技术网

使用调试库登录node.js

使用调试库登录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

我目前正在使用

是否有一种方法可以将调试库中的输出文本保存到类似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');// 我找到了作者使用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