3
在winston當我通過傳遞一個mongoose查詢結果作爲元數據參數來進行日誌記錄時,Winston只是在任務退出之前吐出一千行日誌。在winston傳遞對象作爲元數據時超過了堆棧大小
因此,對於日誌是這樣的:
tSchool.findById(bus.schoolid,function(err,school){
winston.info('loaded school',school);
});
這裏有一小塊什麼讓輸出:
return _next.apply(this, arguments);
}, remove=function wrappedPointCut() {
var args = [].slice.call(arguments);
var lastArg = args.pop();
var fn;
var originalStack = new Error().stack;
var $results;
if (lastArg && typeof lastArg !== 'function') {
args.push(lastArg);
} else {
fn = lastArg;
}
var promise = new Promise.ES6(function(resolve, reject) {
args.push(function(error) {
if (error) {
// gh-2633: since VersionError is very generic, take the
// stack trace of the original save() function call rather
// than the async trace
if (error instanceof VersionError) {
error.stack = originalStack;
}
_this.$__handleReject(error);
reject(error);
return;
}
// There may be multiple results and promise libs other than
// mpromise don't support passing multiple values to `resolve()`
$results = Array.prototype.slice.call(arguments, 1);
resolve.apply(promise, $results);
});
_this[newName].apply(_this, args);
});
if (fn) {
if (_this.constructor.$wrapCallback) {
fn = _this.constructor.$wrapCallback(fn);
}
return promise.then(
function() {
process.nextTick(function() {
fn.apply(null, [null].concat($results));
});
},
function(error) {
process.nextTick(function() {
fn(error);
});
});
}
return promise;
}
所以我想知道的幾件事情:
爲什麼傳遞一個mongoose查詢結果,該結果應該是一個小json對象,打印這樣的亂碼?
這是否會發生其他對象 - 例如回調中的
err
對象.etc?我該如何預防?檢查每個日誌語句以確保沒有查詢結果通過是不實際的。
在此先感謝。
更新:
問題#862,#474和#914正在跟蹤/涉及到這個問題,但一直沒有太大進展。