moved to logger variables

This commit is contained in:
Luis Fernando Molina committed 2020-12-01 15:43:39 +01:00
1 parent 2e6c6f9644
commit 53006f707b
4 files changed
+7 -7

No files matched your search

@@ -11,7 +11,8 @@ exports.newSuperalgosGlobalsLoggerVariables = function () {
PROCESS_INSTANCE_LOGGER_MODULE This is the logger module used by the process instance.
BOT_MAIN_LOOP_LOGGER_MODULE This is the logger module instantiated at every main loop and used at downstream modules.
LOGS_TO_DELETE_QUEUE This stores the logs that need to be deleted, for auto mantainance.
*/
return thisObject
}
@@ -20,7 +20,6 @@ exports.newSuperalgosGlobalsProcessVariables = function () {
SESSION_KEY This is the key used in events related to the Session
SESSION_FOLDER_NAME This is the folder name for Session related data and logs.
MAIN_LOOP_COUNTER This is the counter of main loops for a bot process.
LOGS_TO_DELETE_QUEUE This stores the logs that need to be deleted, for auto mantainance.
SOCIAL_BOTS_MODULE This is the module that controls social bots.
SESSION_STATUS This tell us the status of the session at any given time.
IS_SESSION_STOPPING This tell us if a session is in the process of being stopped.
+4 -4
View File
@@ -115,11 +115,11 @@ exports.newDebugLog = function (processIndex) {
/* This is the implementation of the mechanism to auto-mantain logs. */
if (contentToPersist.indexOf('[ERROR]') < 0 && contentToPersist.indexOf('[PERSIST]') < 0 && contentToPersist.indexOf('[IMPORTANT]') < 0) {
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.push(filePath + '/' + fileName)
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.push(filePath + '/' + fileName)
}
if (TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.length > TS.projects.superalgos.globals.loggerVariables.DELETE_QUEUE_SIZE) {
let fileToDelete = TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE[0]
TS.projects.superalgos.globals.processVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.splice(0, 1)
if (TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.length > TS.projects.superalgos.globals.loggerVariables.DELETE_QUEUE_SIZE) {
let fileToDelete = TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE[0]
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).LOGS_TO_DELETE_QUEUE.splice(0, 1)
/* Will delete this file only if it does not contains ERROR inside. */
let fileContent = fileStorage.getTextFile(fileToDelete, onGetFile, true)
function onGetFile(err, fileContent) {
+1 -1
View File
@@ -29,6 +29,7 @@
We will use a logger for what happens before and after the bot main loop.
*/
VARIABLES_BY_PROCESS_INDEX = {
LOGS_TO_DELETE_QUEUE: [],
PROCESS_INSTANCE_LOGGER_MODULE: DEBUG_MODULE.newDebugLog(processIndex)
}
TS.projects.superalgos.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.set(processIndex, VARIABLES_BY_PROCESS_INDEX)
@@ -39,7 +40,6 @@
accesed from where it is needed.
*/
VARIABLES_BY_PROCESS_INDEX = {
LOGS_TO_DELETE_QUEUE: [],
MAIN_LOOP_COUNTER: 0,
PROCESS_KEY:
TS.projects.superalgos.globals.taskConstants.TASK_NODE.bot.processes[processIndex].name + '-' +