Clean up log a bit

This commit is contained in:
Bryan Ashby 2020-05-07 19:00:32 -06:00
parent 3732914c4a
commit d6dce82a92
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
1 changed files with 16 additions and 6 deletions

View File

@ -517,8 +517,20 @@ function FTNMessageScanTossModule() {
}; };
this.hasValidConfiguration = function() { this.hasValidConfiguration = function({shouldLog = false} = {}) {
if(!_.has(this, 'moduleConfig.nodes') || !_.has(Config(), 'messageNetworks.ftn.areas')) { const hasNodes = _.has(this, 'moduleConfig.nodes');
const hasAreas = _.has(Config(), 'messageNetworks.ftn.areas');
if(!hasNodes && !hasAreas) {
if (shouldLog) {
Log.warn(
{
'scannerTossers.ftn_bso.nodes' : hasNodes,
'messageNetworks.ftn.areas' : hasAreas,
},
'Missing one or more required configuration blocks'
);
}
return false; return false;
} }
@ -2151,9 +2163,7 @@ FTNMessageScanTossModule.prototype.processTicFilesInDirectory = function(importD
FTNMessageScanTossModule.prototype.startup = function(cb) { FTNMessageScanTossModule.prototype.startup = function(cb) {
Log.info(`${exports.moduleInfo.name} Scanner/Tosser starting up`); Log.info(`${exports.moduleInfo.name} Scanner/Tosser starting up`);
if (!this.hasValidConfiguration()) { this.hasValidConfiguration({ shouldLog : true }); // just check and log
Log.debug('No configuration present');
}
let importing = false; let importing = false;
@ -2300,7 +2310,7 @@ FTNMessageScanTossModule.prototype.performImport = function(cb) {
const importDir = self.moduleConfig.paths[inboundType]; const importDir = self.moduleConfig.paths[inboundType];
self.importFromDirectory(inboundType, importDir, err => { self.importFromDirectory(inboundType, importDir, err => {
if (err) { if (err) {
Log.warn({ importDir, error : err.message }, 'Error(s) during import'); Log.trace({ importDir, error : err.message }, 'Cannot perform FTN import for directory');
} }
return nextDir(null); return nextDir(null);