2015-04-04 86 views
0

我可以将此输出的内容写入文件吗?我正在使用debug模块记录消息,我希望能够将它们传送到一个文件。然而它没有按预期工作。将节点调试日志的内容写入文件

$ DEBUG=* node -e 'var debug = require("debug")("test"); debug("hello world")' 
    test hello world +0ms 
$ DEBUG=* node -e 'var debug = require("debug")("test"); debug("hello world")' > temp.txt 
    test hello world +0ms 

刚刚试过这个,并没有收到任何输出。

$ { DEBUG=* node -e "var debug = require('debug')('test'); debug('hello world')"; } >temp.txt 
    test hello world +0ms 
+0

我坚持着同样的问题,只有一个区别。如果我用节点运行我的应用程序 - 一切都很酷并且调试工作正常,但是如果我使用nodemon运行我的应用程序 - 我会收到完全相同的错误。 我创建了一个显示错误的小演示回购https://github.com/speedster-kiev/debug-nodemon-error。 任何建议? – 2015-11-26 15:24:19

回答