Loging at the devTeam Storage
This commit is contained in:
1 parent
991ed20a24
commit
9aab0514aa
17 files changed
+313
-59
No files matched your search
@@ -9,11 +9,15 @@
|
||||
let USER_BOT_MODULE;
|
||||
let COMMONS_MODULE;
|
||||
|
||||
const EVENT_HANDLER_MODULE = require(ROOT_DIR + 'EventHandler');
|
||||
bot.eventHandler = EVENT_HANDLER_MODULE.newEventHandler();
|
||||
|
||||
const DEBUG_MODULE = require(ROOT_DIR + 'Debug Log');
|
||||
const logger = DEBUG_MODULE.newDebugLog();
|
||||
logger.fileName = MODULE_NAME;
|
||||
logger.bot = bot;
|
||||
logger.forceLoopSplit = true;
|
||||
logger.initialize();
|
||||
|
||||
let thisObject = {
|
||||
initialize: initialize,
|
||||
@@ -42,6 +46,7 @@
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] initialize -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
@@ -122,6 +127,7 @@
|
||||
}
|
||||
case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
|
||||
logger.write("[ERROR] run -> loop -> initializeStatusDependencies -> onInizialized -> Operation Failed. Aborting the process.");
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -129,6 +135,7 @@
|
||||
logger.write("[ERROR] run -> loop -> initializeStatusDependencies -> onInizialized -> Unhandled err.result received. -> err.result = " + err.result);
|
||||
logger.write("[ERROR] run -> loop -> initializeStatusDependencies -> onInizialized -> Unhandled err.result received. -> err.message = " + err.message);
|
||||
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -136,12 +143,14 @@
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] run -> loop -> initializeStatusDependencies -> onInizialized -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] run -> loop -> initializeStatusDependencies -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
@@ -176,6 +185,7 @@
|
||||
}
|
||||
case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
|
||||
logger.write("[ERROR] run -> loop -> initializeUserBot -> onInizialized > Operation Failed. Aborting the process.");
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -183,6 +193,7 @@
|
||||
logger.write("[ERROR] run -> loop -> initializeUserBot -> onInizialized > Unhandled err.result received. -> err.result = " + err.result);
|
||||
logger.write("[ERROR] run -> loop -> initializeUserBot -> onInizialized > Unhandled err.result received. -> err.message = " + err.message);
|
||||
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -190,12 +201,14 @@
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] run -> loop -> initializeUserBot -> onInizialized -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] run -> loop -> initializeUserBot -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
@@ -229,6 +242,7 @@
|
||||
}
|
||||
case global.DEFAULT_FAIL_RESPONSE.result: { // This is an unexpected exception that we do not know how to handle.
|
||||
logger.write("[ERROR] run -> loop -> startUserBot -> onFinished > Operation Failed. Aborting the process.");
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -249,16 +263,19 @@
|
||||
}
|
||||
case "Month before it is needed.": {
|
||||
logger.write("[WARN] run -> loop -> startUserBot -> onFinished > Month before it is needed. This Loop will be terminated.");
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
case "Month fully processed.": {
|
||||
logger.write("[WARN] run -> loop -> startUserBot -> onFinished > Month fully processed. This Loop will be terminated.");
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
case "End of the month reached.": {
|
||||
logger.write("[WARN] run -> loop -> startUserBot -> onFinished > End of the month reached. This Loop will be terminated.");
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -270,6 +287,7 @@
|
||||
}
|
||||
default: {
|
||||
logger.write("[ERROR] run -> loop -> startUserBot -> onFinished > Unhandled custom response received. -> err.message = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
@@ -279,6 +297,7 @@
|
||||
logger.write("[ERROR] run -> loop -> startUserBot -> onFinished > Unhandled err.result received. -> err.result = " + err.result);
|
||||
logger.write("[ERROR] run -> loop -> startUserBot -> onFinished > Unhandled err.result received. -> err.message = " + err.message);
|
||||
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
return;
|
||||
}
|
||||
@@ -286,18 +305,21 @@
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] run -> loop -> startUserBot -> onFinished -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] run -> loop -> startUserBot -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
logger.write("[ERROR] run -> loop -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(err);
|
||||
}
|
||||
}
|
||||
@@ -313,6 +335,7 @@
|
||||
if (bot.runAtFixedInterval === true) { intervalHandle.clearInterval();}
|
||||
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Stopping the Loop Gracefully. See you next time! :-)"); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
return;
|
||||
|
||||
@@ -324,24 +347,29 @@
|
||||
case 'Normal': {
|
||||
if (bot.runAtFixedInterval === true) {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Fixed Interval Normal exit point reached."); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
return;
|
||||
} else {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.normalWaitTime / 1000) + " seconds."); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
setTimeout(loop, processConfig.normalWaitTime);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'Retry': {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.retryWaitTime / 1000) + " seconds."); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
setTimeout(loop, processConfig.retryWaitTime);
|
||||
}
|
||||
break;
|
||||
case 'Sleep': {
|
||||
if (bot.runAtFixedInterval === true) {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Fixed Interval Sleep exit point reached."); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
return;
|
||||
} else {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.sleepWaitTime / 60000) + " minutes."); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
setTimeout(loop, processConfig.sleepWaitTime);
|
||||
}
|
||||
}
|
||||
@@ -349,9 +377,11 @@
|
||||
case 'Coma': {
|
||||
if (bot.runAtFixedInterval === true) {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Fixed Interval Coma exit point reached."); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
return;
|
||||
} else {
|
||||
if (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.comaWaitTime / 3600000) + " hours."); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
setTimeout(loop, processConfig.comaWaitTime);
|
||||
}
|
||||
}
|
||||
@@ -369,16 +399,17 @@
|
||||
return JSON.parse(global.PLATFORM_CONFIG.stopGracefully);
|
||||
}
|
||||
catch (err) {
|
||||
const logText = "[ERROR] 'readConfig' - ERROR : " + err.message;
|
||||
console.log(logText);
|
||||
|
||||
return;
|
||||
logger.write("[ERROR] run -> shallWeStop -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (err) {
|
||||
logger.write("[ERROR] run -> err = " + err.message);
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user