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);
|
||||
}
|
||||
}
|
||||
@@ -112,6 +117,8 @@
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -119,6 +126,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;
|
||||
}
|
||||
@@ -126,12 +134,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);
|
||||
}
|
||||
}
|
||||
@@ -166,6 +176,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;
|
||||
}
|
||||
@@ -173,6 +184,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;
|
||||
}
|
||||
@@ -180,12 +192,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);
|
||||
}
|
||||
}
|
||||
@@ -219,6 +233,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;
|
||||
}
|
||||
@@ -239,16 +254,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;
|
||||
}
|
||||
@@ -260,6 +278,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;
|
||||
}
|
||||
@@ -269,6 +288,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;
|
||||
}
|
||||
@@ -276,18 +296,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);
|
||||
}
|
||||
}
|
||||
@@ -301,6 +324,8 @@
|
||||
if (shallWeStop() === true) {
|
||||
|
||||
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;
|
||||
|
||||
@@ -311,21 +336,25 @@
|
||||
switch (nextWaitTime) {
|
||||
case 'Normal': {
|
||||
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 (FULL_LOG === true) { logger.write("[INFO] run -> loopControl -> Restarting Loop in " + (processConfig.sleepWaitTime / 60000) + " minutes."); }
|
||||
bot.eventHandler.raiseEvent("Loop Finished");
|
||||
setTimeout(loop, processConfig.sleepWaitTime);
|
||||
}
|
||||
break;
|
||||
case 'Coma': {
|
||||
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);
|
||||
}
|
||||
break;
|
||||
@@ -342,16 +371,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