* Clean up some logs

* Add serializer for 'err' in logs for passing full err object
* Don't dump HUGE message lists to log during new scan
This commit is contained in:
Bryan Ashby 2016-07-16 13:05:32 -06:00
parent 14c8b39a9e
commit 485711b5da
4 changed files with 44 additions and 19 deletions

View file

@ -165,12 +165,31 @@ function NewScanModule(options) {
},
function displayMessageList(msgList) {
if(msgList && msgList.length > 0) {
var nextModuleOpts = {
const nextModuleOpts = {
extraArgs: {
messageAreaTag : currentArea.areaTag,
messageList : msgList,
}
};
//
// provide a serializer so we don't dump *huge* bits of information to the log
// due to the size of |messageList|
// https://github.com/trentm/node-bunyan/issues/189
//
nextModuleOpts.extraArgs.toJSON = function() {
let logMsgList;
if(this.messageList.length <= 4) {
logMsgList = this.messageList;
} else {
logMsgList = this.messageList.slice(0, 2).concat(this.messageList.slice(-2));
}
return {
messageAreaTag : this.messageAreaTag,
partialMessageList : logMsgList,
};
};
self.gotoMenu(config.newScanMessageList || 'newScanMessageList', nextModuleOpts);
} else {
@ -221,13 +240,13 @@ NewScanModule.prototype.mciReady = function(mciData, cb) {
},
function performCurrentStepScan(callback) {
switch(self.currentStep) {
case 'messageConferences' :
self.newScanMessageConference( () => {
callback(null); // finished
});
case 'messageConferences' :
self.newScanMessageConference( () => {
callback(null); // finished
});
break;
default : return callback(null);
default : return callback(null);
}
}
],