mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-07 05:05:26 +02:00
* 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:
parent
14c8b39a9e
commit
485711b5da
4 changed files with 44 additions and 19 deletions
22
core/bbs.js
22
core/bbs.js
|
@ -218,7 +218,11 @@ function startListening(cb) {
|
||||||
|
|
||||||
moduleUtil.loadModulesForCategory('servers', (err, module) => {
|
moduleUtil.loadModulesForCategory('servers', (err, module) => {
|
||||||
if(err) {
|
if(err) {
|
||||||
logger.log.info(err);
|
if('EENIGMODDISABLED' === err.code) {
|
||||||
|
logger.log.debug(err.message);
|
||||||
|
} else {
|
||||||
|
logger.log.info( { err : err }, 'Failed loading module');
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,14 +232,14 @@ function startListening(cb) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleInst = new module.getModule();
|
const moduleInst = new module.getModule();
|
||||||
let server;
|
let server;
|
||||||
try {
|
try {
|
||||||
server = moduleInst.createServer();
|
server = moduleInst.createServer();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
logger.log.warn(e, 'Exception caught creating server!');
|
logger.log.warn(e, 'Exception caught creating server!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: handle maxConnections, e.g. conf.maxConnections
|
// :TODO: handle maxConnections, e.g. conf.maxConnections
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var bunyan = require('bunyan');
|
var bunyan = require('bunyan');
|
||||||
var miscUtil = require('./misc_util.js');
|
|
||||||
var paths = require('path');
|
var paths = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
|
@ -57,7 +56,8 @@ module.exports = {
|
||||||
stream : ringBuffer,
|
stream : ringBuffer,
|
||||||
level : 'trace'
|
level : 'trace'
|
||||||
}*/
|
}*/
|
||||||
]
|
],
|
||||||
|
serializers: { err : bunyan.stdSerializers.err } // handle 'err' fields with stack/etc.
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,9 @@ function loadModuleEx(options, cb) {
|
||||||
const modConfig = _.isObject(Config[options.category]) ? Config[options.category][options.name] : null;
|
const modConfig = _.isObject(Config[options.category]) ? Config[options.category][options.name] : null;
|
||||||
|
|
||||||
if(_.isObject(modConfig) && false === modConfig.enabled) {
|
if(_.isObject(modConfig) && false === modConfig.enabled) {
|
||||||
return cb(new Error(`Module "${options.name}" is disabled`));
|
const err = new Error(`Module "${options.name}" is disabled`);
|
||||||
|
err.code = 'EENIGMODDISABLED';
|
||||||
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -165,12 +165,31 @@ function NewScanModule(options) {
|
||||||
},
|
},
|
||||||
function displayMessageList(msgList) {
|
function displayMessageList(msgList) {
|
||||||
if(msgList && msgList.length > 0) {
|
if(msgList && msgList.length > 0) {
|
||||||
var nextModuleOpts = {
|
const nextModuleOpts = {
|
||||||
extraArgs: {
|
extraArgs: {
|
||||||
messageAreaTag : currentArea.areaTag,
|
messageAreaTag : currentArea.areaTag,
|
||||||
messageList : msgList,
|
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);
|
self.gotoMenu(config.newScanMessageList || 'newScanMessageList', nextModuleOpts);
|
||||||
} else {
|
} else {
|
||||||
|
@ -221,13 +240,13 @@ NewScanModule.prototype.mciReady = function(mciData, cb) {
|
||||||
},
|
},
|
||||||
function performCurrentStepScan(callback) {
|
function performCurrentStepScan(callback) {
|
||||||
switch(self.currentStep) {
|
switch(self.currentStep) {
|
||||||
case 'messageConferences' :
|
case 'messageConferences' :
|
||||||
self.newScanMessageConference( () => {
|
self.newScanMessageConference( () => {
|
||||||
callback(null); // finished
|
callback(null); // finished
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default : return callback(null);
|
default : return callback(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue