2015-04-04 89 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

回答