[英]How do I use npm forever-monitor to log to stdout
我有一個簡單的nodejs docker服務。 我正在開發stdout並在生產中登錄AWS cloudwatch。
我剛剛添加了永遠監視器,但這打破了我的日志記錄。 所以我開始在子進程上捕獲stdout,
const forever = require('forever-monitor');
const child = new (forever.Monitor)('server.js', {
max: 3,
silent: true,
args: []
});
child.on('stdout', function(data) {
console.log(data);
});
但這只是給我字節碼 -
[nodemon] starting `node forever.js`
<Buffer 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 6c 69 76 65 20 64 62 0a>
如何將我的console.log
語句恢復為std-out?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.