gpt4 book ai didi

node.js - 使用调试库登录node.js

转载 作者:太空宇宙 更新时间:2023-11-03 23:39:02 24 4
gpt4 key购买 nike

我目前正在使用debug library .

有没有办法可以将调试库的输出文本保存到像 Winston 这样的日志文件中。

例如...伪代码...

var debug = require('debug')('test');
// debug.bind('test.log'); // <-- something like this..
debug('hello world');

所以..“hello world”应该在 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?!');

来源:http://devgigs.blogspot.kr/2014/01/mastering-nodejs-logging.html?m=1

关于node.js - 使用调试库登录node.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27262343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com