1
使用winston記錄器將內容寫入文件,但僅在使用customlogger.error
時才起作用。如果節點正在輸出一些像下面的參考錯誤如何輸出process.stderr.write到winston
ReferenceError: aksbd is not defined
at /home/nigilan/Desktop/homepagelogger/app.js:53:20
at Layer.handle [as handle_request] (/home/nigilan/Desktop/homepagelogger/node_modules/express/lib/router/layer.js:95:5)
at next (/home/nigilan/Desktop/homepagelogger/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/nigilan/Desktop/homepagelogger/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/nigilan/Desktop/homepagelogger/node_modules/express/lib/router/layer.js:95:5)
at /home/nigilan/Desktop/homepagelogger/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/home/nigilan/Desktop/homepagelogger/node_modules/express/lib/router/index.js:335:12)
at next (/home/nigilan/Desktop/homepagelogger/node_modules/express/lib/router/index.js:275:10)
at /home/nigilan/Desktop/homepagelogger/app.js:38:5
at Layer.handle [as handle_request] (/home/nigilan/Desktop/homepagelogger/node_modules/express/lib/router/layer.js:95:5)
如何使用Winston存儲類似上面的錯誤?
P.S.記錄未處理的異常是nodejs服務器工作正常。
此代碼工作正常,但溫斯頓會非常有幫助。 (err)throw err; });函數(message){0}; } – Nigilan