Logging functionality re-written, all modules affected
This commit is contained in:
1 parent
dfefc0ff26
commit
2e28f86fd5
19 files changed
+1362
-1524
No files matched your search
+57
-61
@@ -1,4 +1,4 @@
|
||||
exports.newStatusReport = function newStatusReport(BOT, DEBUG_MODULE, BLOB_STORAGE, UTILITIES) {
|
||||
exports.newStatusReport = function newStatusReport(BOT, logger, BLOB_STORAGE, UTILITIES) {
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,14 +8,10 @@
|
||||
|
||||
*/
|
||||
|
||||
const MODULE_NAME = "StatusReport";
|
||||
const MODULE_NAME = "Status Report";
|
||||
|
||||
let bot = BOT;
|
||||
|
||||
const logger = DEBUG_MODULE.newDebugLog();
|
||||
logger.bot = bot;
|
||||
logger.initialize();
|
||||
|
||||
let thisObject = {
|
||||
file: undefined, // Here we have the JSON object representing the file content.
|
||||
initialize: initialize,
|
||||
@@ -29,11 +25,11 @@
|
||||
|
||||
/* Utilities needed. */
|
||||
|
||||
let utilities = UTILITIES.newCloudUtilities(bot);
|
||||
let utilities = UTILITIES.newCloudUtilities(bot, logger);
|
||||
|
||||
/* Storage account to be used here. */
|
||||
|
||||
let cloudStorage = BLOB_STORAGE.newBlobStorage(bot);
|
||||
let cloudStorage = BLOB_STORAGE.newBlobStorage(bot, logger);
|
||||
|
||||
let month;
|
||||
let year;
|
||||
@@ -58,7 +54,7 @@
|
||||
timePath = "/" + year + "/" + month;
|
||||
}
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] initialize -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Entering function."); }
|
||||
|
||||
|
||||
initializeStorage();
|
||||
@@ -71,17 +67,17 @@
|
||||
|
||||
if (err.result === global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] initialize -> initializeStorage -> onInizialized -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> initializeStorage -> onInizialized -> Entering function."); }
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
|
||||
} else {
|
||||
logger.write("[ERROR] initialize -> initializeStorage -> onInizialized -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> initializeStorage -> onInizialized -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] initialize -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
@@ -90,14 +86,14 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] initialize -> load -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> load -> Entering function."); }
|
||||
|
||||
let rootPath = owner.devTeam + "/" + owner.bot + "." + owner.botVersion.major + "." + owner.botVersion.minor + "/" + global.PLATFORM_CONFIG.codeName + "." + global.PLATFORM_CONFIG.version.major + "." + global.PLATFORM_CONFIG.version.minor + "/" + global.EXCHANGE_NAME + "/" + owner.dataSetVersion;
|
||||
let fileName = "Status.Report." + global.MARKET.assetA + '_' + global.MARKET.assetB + ".json";
|
||||
let filePath = rootPath + "/Reports/" + owner.process + timePath;
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] initialize -> load -> fileName = " + fileName); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] initialize -> load -> filePath = " + filePath); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> load -> fileName = " + fileName); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> load -> filePath = " + filePath); }
|
||||
|
||||
cloudStorage.getTextFile(filePath, fileName, onFileReceived);
|
||||
|
||||
@@ -107,7 +103,7 @@
|
||||
err.result === global.CUSTOM_FAIL_RESPONSE.result &&
|
||||
(err.message === 'Folder does not exist.' || err.message === 'File does not exist.')
|
||||
) {
|
||||
logger.write("[INFO] initialize -> load -> onFileReceived -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[INFO] initialize -> load -> onFileReceived -> err = " + err.message);
|
||||
|
||||
/* In this case we can assume that this is the first execution ever of this bot.*/
|
||||
|
||||
@@ -117,19 +113,19 @@
|
||||
result: global.CUSTOM_OK_RESPONSE.result,
|
||||
message: "Status Report was never created."
|
||||
};
|
||||
logger.write("[WARN] initialize -> load -> onFileReceived -> customOK = " + customOK.message);
|
||||
logger.write(MODULE_NAME, "[WARN] initialize -> load -> onFileReceived -> customOK = " + customOK.message);
|
||||
callBackFunction(customOK);
|
||||
return;
|
||||
}
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
logger.write("[ERROR] initialize -> load -> onFileReceived -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> load -> onFileReceived -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logContent === true) {
|
||||
logger.write("[INFO] initialize -> load -> onFileReceived -> Content received = " + text);
|
||||
logger.write(MODULE_NAME, "[INFO] initialize -> load -> onFileReceived -> Content received = " + text);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -144,20 +140,20 @@
|
||||
is being updated at the moment of the read. The bot can not run without a valid Status Report but we can request the platform to retry later.
|
||||
*/
|
||||
|
||||
logger.write("[ERROR] initialize -> load -> onFileReceived -> Error Parsing the Status report. -> Err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> load -> onFileReceived -> Error Parsing the Status report. -> Err = " + err.message);
|
||||
|
||||
let customFail = {
|
||||
result: global.CUSTOM_FAIL_RESPONSE.result,
|
||||
message: "Status Report is corrupt."
|
||||
};
|
||||
logger.write("[WARN] initialize -> load -> onFileReceived -> customFail = " + customFail.message);
|
||||
logger.write(MODULE_NAME, "[WARN] initialize -> load -> onFileReceived -> customFail = " + customFail.message);
|
||||
callBackFunction(customFail);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] initialize -> load -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> load -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
@@ -166,7 +162,7 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] save -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] save -> Entering function."); }
|
||||
|
||||
let ownerId = owner.devTeam + "-" + owner.bot + "-" + owner.botVersion.major + "-" + owner.botVersion.minor + "-" + owner.process + "-" + owner.dataSetVersion;
|
||||
let botId = bot.devTeam + "-" + bot.codeName + "-" + bot.version.major + "-" + bot.version.minor + "-" + bot.process + "-" + bot.dataSetVersion;
|
||||
@@ -177,7 +173,7 @@
|
||||
result: global.CUSTOM_FAIL_RESPONSE.result,
|
||||
message: "Only bots owners of a Status Report can save them."
|
||||
};
|
||||
logger.write("[ERROR] save -> customErr = " + customErr.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] save -> customErr = " + customErr.message);
|
||||
callBackFunction(customErr);
|
||||
return;
|
||||
}
|
||||
@@ -185,8 +181,8 @@
|
||||
let fileName = "Status.Report." + global.MARKET.assetA + '_' + global.MARKET.assetB + ".json";
|
||||
let filePath = bot.filePathRoot + "/Reports/" + owner.process + timePath;
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] save -> fileName = " + fileName); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] save -> filePath = " + filePath); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] save -> fileName = " + fileName); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] save -> filePath = " + filePath); }
|
||||
|
||||
utilities.createFolderIfNeeded(filePath, cloudStorage, onFolderCreated);
|
||||
|
||||
@@ -194,10 +190,10 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] save -> onFolderCreated -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] save -> onFolderCreated -> Entering function."); }
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
logger.write("[ERROR] save -> onFolderCreated -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] save -> onFolderCreated -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -208,16 +204,16 @@
|
||||
|
||||
function onFileCreated(err) {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] save -> onFolderCreated -> onFileCreated -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] save -> onFolderCreated -> onFileCreated -> Entering function."); }
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
logger.write("[ERROR] save -> onFolderCreated -> onFileCreated -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] save -> onFolderCreated -> onFileCreated -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logContent === true) {
|
||||
logger.write("[INFO] save -> onFolderCreated -> onFileCreated -> Content written = " + fileContent);
|
||||
logger.write(MODULE_NAME, "[INFO] save -> onFolderCreated -> onFileCreated -> Content written = " + fileContent);
|
||||
}
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
@@ -225,13 +221,13 @@
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
logger.write("[ERROR] save -> onFolderCreated -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] save -> onFolderCreated -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
logger.write("[ERROR] save -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] save -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
@@ -250,7 +246,7 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> Entering function."); }
|
||||
|
||||
let initialYear;
|
||||
let initialMonth;
|
||||
@@ -266,24 +262,24 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> onLoad -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> onLoad -> Entering function."); }
|
||||
|
||||
if (
|
||||
err.result === global.CUSTOM_FAIL_RESPONSE.result &&
|
||||
(err.message === 'Status Report was never created.')
|
||||
) {
|
||||
logger.write("[INFO] verifyMarketComplete -> onLoad -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> onLoad -> err = " + err.message);
|
||||
|
||||
/* The first month of the market didnt create the main report yet. Aborting verification. */
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> onLoad -> Verification ABORTED since the main status report does not exist."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> onLoad -> Verification ABORTED since the main status report does not exist."); }
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> onLoad -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> onLoad -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -296,7 +292,7 @@
|
||||
loopCycle();
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> onLoad -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> onLoad -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -306,7 +302,7 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> loopCycle -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> loopCycle -> Entering function."); }
|
||||
|
||||
/* Here we read the status report file of each month / year to verify if it is complete or not. */
|
||||
|
||||
@@ -320,24 +316,24 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> loopCycle -> onLoad -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> loopCycle -> onLoad -> Entering function."); }
|
||||
|
||||
if (
|
||||
err.result === global.CUSTOM_FAIL_RESPONSE.result &&
|
||||
(err.message === 'Status Report was never created.')
|
||||
) {
|
||||
logger.write("[INFO] verifyMarketComplete -> loopCycle -> onLoad -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> loopCycle -> onLoad -> err = " + err.message);
|
||||
|
||||
/* The first month of the market didnt create the main report yet. Aborting verification. */
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> loopCycle -> onLoad -> Verification ABORTED since the status report for year " + initialYear + " and month " + initialMonth + " did not exist. "); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> loopCycle -> onLoad -> Verification ABORTED since the status report for year " + initialYear + " and month " + initialMonth + " did not exist. "); }
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> loopCycle -> onLoad -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> loopCycle -> onLoad -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -350,20 +346,20 @@
|
||||
|
||||
/* If any of the files says that month is not checked then it is enough to know the market continuity is broken. */
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> loopCycle -> onLoad -> Verification ABORTED since the status report for year " + initialYear + " and month " + initialMonth + " is not marked as complete."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> loopCycle -> onLoad -> Verification ABORTED since the status report for year " + initialYear + " and month " + initialMonth + " is not marked as complete."); }
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> loopCycle -> onLoad -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> loopCycle -> onLoad -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> loopCycle -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> loopCycle -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -373,7 +369,7 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> readAndWriteNewReport -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> readAndWriteNewReport -> Entering function."); }
|
||||
|
||||
/* We will read the current file to preserve its data, and save it again with the new lastFile */
|
||||
|
||||
@@ -387,10 +383,10 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> Entering function."); }
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -407,10 +403,10 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> onSave -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> onSave -> Entering function."); }
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> onSave -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> onSave -> err = " + err.message);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -418,7 +414,7 @@
|
||||
loop(); // Lets see the next month.
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> onSave -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> onSave -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -426,20 +422,20 @@
|
||||
|
||||
} else {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> Main Status Report Not Updated."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> Current Trade Id (" + monthlyStatusReport.lastTrade.id + ") is <= than Id at main status report file. (" + thisObject.file.lastTrade.id + ")"); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> Main Status Report Not Updated."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> Current Trade Id (" + monthlyStatusReport.lastTrade.id + ") is <= than Id at main status report file. (" + thisObject.file.lastTrade.id + ")"); }
|
||||
|
||||
loop(); // Lets see the next month.
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> readAndWriteNewReport -> onLoad -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> loopCycle -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> loopCycle -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -449,7 +445,7 @@
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> loop -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> loop -> Entering function."); }
|
||||
|
||||
initialMonth++;
|
||||
|
||||
@@ -464,7 +460,7 @@
|
||||
|
||||
/* We arrived to the point where we have checked all the status reports of every month and they are all complete. */
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write("[INFO] verifyMarketComplete -> loop -> Verification Finished. Success."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] verifyMarketComplete -> loop -> Verification Finished. Success."); }
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
@@ -473,7 +469,7 @@
|
||||
loopCycle();
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] verifyMarketComplete -> loop -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> loop -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -481,7 +477,7 @@
|
||||
}
|
||||
catch (err)
|
||||
{
|
||||
logger.write("[ERROR] verifyMarketComplete -> err = " + err.message);
|
||||
logger.write(MODULE_NAME, "[ERROR] verifyMarketComplete -> err = " + err.message);
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user