【发布时间】:2015-04-04 15:30:23
【问题描述】:
我可以将此输出的内容写入文件吗?我正在使用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
【问题讨论】:
-
我遇到了同样的问题,只有一处不同。如果我使用 node 运行我的应用程序 - 一切都很酷并且调试工作正常,但是如果我使用 nodemon 运行我的应用程序 - 我会收到完全相同的错误。我创建了显示错误的小型演示 repo github.com/speedster-kiev/debug-nodemon-error。有什么建议吗?