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正在跟踪/涉及到这个问题,但一直没有太大进展。