Add extra logging around TIC processing

This commit is contained in:
Bryan Ashby 2017-09-29 19:43:22 -06:00
parent e84920e508
commit 8b7cf1f210
1 changed files with 18 additions and 5 deletions

View File

@ -1289,6 +1289,7 @@ function FTNMessageScanTossModule() {
return ticFileInfo.validate(config, (err, localInfo) => { return ticFileInfo.validate(config, (err, localInfo) => {
if(err) { if(err) {
Log.trace( { reason : err.message }, 'Validation failure');
return callback(err); return callback(err);
} }
@ -1349,10 +1350,17 @@ function FTNMessageScanTossModule() {
localInfo.existingFileId = fileIds[0]; localInfo.existingFileId = fileIds[0];
// fetch old filename - we may need to remove it if replacing with a new name // fetch old filename - we may need to remove it if replacing with a new name
FileEntry.loadBasicEntry(localInfo.existingFileId, {}, (cb, info) => { FileEntry.loadBasicEntry(localInfo.existingFileId, {}, (err, info) => {
localInfo.oldFileName = info.fileName; if(info) {
localInfo.oldStorageTag = info.storageTag; Log.trace(
return callback(null, localInfo); { fileId : localInfo.existingFileId, oldFileName : info.fileName, oldStorageTag : info.storageTag },
'Existing TIC file target to be replaced'
);
localInfo.oldFileName = info.fileName;
localInfo.oldStorageTag = info.storageTag;
}
return callback(null, localInfo); // continue even if we couldn't find an old match
}); });
} else if(fileIds.legnth > 1) { } else if(fileIds.legnth > 1) {
return callback(Errors.General(`More than one existing entry for TIC in ${localInfo.areaTag} ([${fileIds.join(', ')}])`)); return callback(Errors.General(`More than one existing entry for TIC in ${localInfo.areaTag} ([${fileIds.join(', ')}])`));
@ -1397,6 +1405,10 @@ function FTNMessageScanTossModule() {
ticFileInfo.filePath, ticFileInfo.filePath,
scanOpts, scanOpts,
(err, fileEntry) => { (err, fileEntry) => {
if(err) {
Log.trace( { reason : err.message }, 'Scanning failed');
}
localInfo.fileEntry = fileEntry; localInfo.fileEntry = fileEntry;
return callback(err, localInfo); return callback(err, localInfo);
} }
@ -1441,6 +1453,7 @@ function FTNMessageScanTossModule() {
self.copyTicAttachment(ticFileInfo.filePath, dst, isUpdate, (err, finalPath) => { self.copyTicAttachment(ticFileInfo.filePath, dst, isUpdate, (err, finalPath) => {
if(err) { if(err) {
Log.info( { reason : err.message }, 'Failed to copy TIC attachment');
return callback(err); return callback(err);
} }
@ -1474,7 +1487,7 @@ function FTNMessageScanTossModule() {
], ],
(err, localInfo) => { (err, localInfo) => {
if(err) { if(err) {
Log.error( { error : err.message, reason : err.reason, tic : ticFileInfo.path }, 'Failed import/update TIC record' ); Log.error( { error : err.message, reason : err.reason, tic : ticFileInfo.filePath }, 'Failed import/update TIC record' );
} else { } else {
Log.debug( Log.debug(
{ tic : ticFileInfo.path, file : ticFileInfo.filePath, area : localInfo.areaTag }, { tic : ticFileInfo.path, file : ticFileInfo.filePath, area : localInfo.areaTag },