我做错了什么?给出以下咖啡脚本:
logrotate = require 'logrotate-stream'
toLogFile = logrotate { file: 'wallboard.log', size: '20m', keep: 10}
console.log "Test before"
process.stdout.pipe toLogFile
console.log "Test after"
这就是:
Test before
Error: This socket is closed.
at WriteStream.Socket._writeGeneric (net.js:628:19)
at WriteStream.Socket._write (net.js:679:8)
at doWrite (_stream_writable.js:265:12)
at writeOrBuffer (_stream_writable.js:252:5)
at WriteStream.Writable.write (_stream_writable.js:197:11)
at WriteStream.Socket.write (net.js:606:40)
at Console.log (console.js:53:16)
at Object.<anonymous> (c:\vmcommon\dev\node\wallboard\_test_stdout.coffee:6:9)
at Object.<anonymous> (c:\vmcommon\dev\node\wallboard\_test_stdout.coffee:1:1)
at Module._compile (module.js:449:26)
为什么没有按预期工作process.stdout.pipe
?
我正在尝试使用NPM: logrotate-stream将所有控制台输出重定向到一个文件,该文件应由库旋转。