-1
我試圖安慰這個登錄使用overiding,但我發現了錯誤。代碼工作正常,當我刪除JSON.stringify(arguments[0])
,但我需要它在JSON格式。如何通過重寫來以JSON格式輸出這些內容?
app.use(function(req, res, next) {
var t_log= console.log;
console.log = function(){
arguments[0] = JSON.stringify(arguments[0])+" sessionID " + req.sessionID + " requestID=" + req.id +" timestamp"+ new Date();
t_log.apply(console, arguments);
}
console.log("call");
next();
});
什麼是'參數[0]'開始與?什麼是'arguments.length'?你遇到了什麼錯誤? –
@Paul我在控制檯中獲得無限'\'。 –