Final touchs after the big Debug Log re organization

This commit is contained in:
Luis Fernando Molina committed 2018-06-07 01:35:10 +02:00
1 parent 2e28f86fd5
commit 149eb01e52
4 files changed
+38 -30

No files matched your search

+4 -16
View File
@@ -131,7 +131,6 @@
let responseData = '';
let err = null;
let alreadyCalledBack = false;
/* We add the headers. */
@@ -145,14 +144,9 @@
request.on('error', onError);
function onError(err) {
console.log("Error: ", err);
if (alreadyCalledBack === false) {
alreadyCalledBack = true;
callBack(err);
} else {
console.log("Not calling back for the same problem.");
}
callBack(err);
}
function onResponse(response) {
@@ -186,7 +180,6 @@
let responseData = '';
let err = null;
let responseCode;
let alreadyCalledBack = false;
/* We add the headers. */
@@ -204,14 +197,9 @@
request.on('error', onError);
function onError(err) {
console.log("Error: ", err);
if (alreadyCalledBack === false) {
alreadyCalledBack = true;
callBack(err);
} else {
console.log("Not calling back for the same problem.");
}
callBack(err);
}
function onResponse(response) {
+8 -1
View File
@@ -123,7 +123,14 @@ exports.newBlobStorage = function newBlobStorage(BOT, logger) {
if (ERROR_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileCreated -> err = " + JSON.stringify(err)); }
if (ERROR_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileCreated -> result = " + JSON.stringify(result)); }
if (ERROR_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileCreated -> response = " + JSON.stringify(response)); }
if (ERROR_LOG === true && logger !== undefined) { logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileCreated -> err.code = " + err.code); }
if (ERROR_LOG === true && logger !== undefined) {
logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileReceived -> Error trying to create this file.");
logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileReceived -> containerName = " + containerName);
logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileReceived -> pFolderPath = " + pFolderPath);
logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileReceived -> pFileName = " + pFileName);
logger.write(MODULE_NAME, "[ERROR] createTextFile -> onFileReceived -> err.code = " + err.code);
}
if (
err.code === 'ECONNRESET' ||
+19 -11
View File
@@ -69,19 +69,26 @@
let fileName = "Loop." + pad(thisObject.bot.loopCounter, 8) + ".json";
cloudStorage.createTextFile(filePath, fileName, blobContent + '\r\n' + "]", onFileCreated);
writeLog();
function onFileCreated(err) {
function writeLog() {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
console.log("[ERROR] DebugLog -> persist -> onInizialized -> onFileCreated -> err = " + err.message);
console.log("[ERROR] DebugLog -> persist -> onInizialized -> onFileCreated -> filePath = " + filePath);
console.log("[ERROR] DebugLog -> persist -> onInizialized -> onFileCreated -> fileName = " + fileName);
return;
cloudStorage.createTextFile(filePath, fileName, blobContent + '\r\n' + "]", onFileCreated);
function onFileCreated(err) {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
console.log("[ERROR] DebugLog -> persist -> onInizialized -> onFileCreated -> err = " + err.message);
console.log("[ERROR] DebugLog -> persist -> onInizialized -> onFileCreated -> filePath = " + filePath);
console.log("[ERROR] DebugLog -> persist -> onInizialized -> onFileCreated -> fileName = " + fileName);
setTimeout(writeLog, 10000); // Lets retry until we make it.
return;
}
blobContent = "";
thisObject = {};
}
blobContent = "";
thisObject = {};
}
} else {
@@ -122,7 +129,8 @@
if (pMessage.indexOf("[ERROR]") >= 0) {
console.log("AACloud" + spacePad(pModule, 50) + " : " + pMessage);
let now = new Date;
console.log(now.toUTCString() + " AACloud" + spacePad(pModule, 15) + " : " + pMessage);
}
}
+7 -2
View File
@@ -720,7 +720,10 @@ exports.newRoot = function newRoot() {
logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runIndicatorBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully.");
logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runIndicatorBot -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId);
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runIndicatorBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully.");
console.log(logDisplace + "Root : [INFO] start -> findProcess -> runIndicatorBot -> onInitializeReady -> whenStartFinishes -> botId = " + botId);
console.log(logDisplace + "Root : [INFO] start -> findProcess -> runIndicatorBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully.");
logger.persist();
} else {
@@ -780,7 +783,9 @@ exports.newRoot = function newRoot() {
logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runTradingBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully.");
logger.write(MODULE_NAME, "[INFO] start -> findProcess -> runTradingBot -> onInitializeReady -> whenStartFinishes -> Bot Id = " + botId);
console.log(logDisplace + "Root : [ERROR] start -> findProcess -> runTradingBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully.");
console.log(logDisplace + "Root : [INFO] start -> findProcess -> runTradingBot -> onInitializeReady -> whenStartFinishes -> botId = " + botId);
console.log(logDisplace + "Root : [INFO] start -> findProcess -> runTradingBot -> onInitializeReady -> whenStartFinishes -> Bot execution finished sucessfully.");
logger.persist();
} else {