Internal Loop Logging

This commit is contained in:
Luis Fernando Molina committed 2018-06-22 14:13:08 +02:00
1 parent 7883202110
commit b825914444
5 files changed
+19 -14

No files matched your search

+14 -10
View File
@@ -15,7 +15,7 @@
let thisObject = {
bot: undefined,
write: write,
flush: flush,
newInternalLoop: newInternalLoop,
persist: persist, // This method is executed at the end of each Main Loop.
initialize: initialize
};
@@ -24,7 +24,7 @@
let disableLogging;
let flushCounter = 0;
let internalLoopCounter = -1;
return thisObject;
@@ -39,15 +39,17 @@
}
}
function flush() {
function newInternalLoop(pBot, pProcess) {
/*
This method will partition the loop log file into several chuncks, each time is executed. It is intended for long processes that needs to show their advance
and release memory used by accumulating messages in this module.
*/
flushCounter++;
console.log(new Date().toISOString() + " " + strPad(pBot, 20) + " " + strPad(pProcess, 30) + " Entered into Internal Loop # " + strPad(internalLoopCounter + 1, 4));
persist();
function strPad(str, max) {
str = str.toString();
return str.length < max ? strPad(" " + str, max) : str;
}
}
function persist() {
@@ -56,6 +58,8 @@
try {
internalLoopCounter++;
if (global.CURRENT_EXECUTION_AT === "Browser") {
//console.log("[INFO] DebugLog -> persist -> We do not persist logs while running at the Browser");
@@ -86,9 +90,9 @@
let fileName;
if (flushCounter > 0) {
if (internalLoopCounter >= 0) {
fileName = "Loop." + pad(thisObject.bot.loopCounter, 8) + "." + pad(flushCounter, 4) + ".json";
fileName = "Loop." + pad(thisObject.bot.loopCounter, 8) + "." + pad(internalLoopCounter, 4) + ".json";
} else {
+1 -1
View File
@@ -150,7 +150,7 @@
return str.length < max ? pad(" " + str, max) : str;
}
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " Entered into Loop # " + pad(Number(bot.loopCounter) + 1, 5));
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " Entered into Main Loop # " + pad(Number(bot.loopCounter) + 1, 8));
/* For each loop we want to create a new log file. */
+2 -2
View File
@@ -151,7 +151,7 @@
return str.length < max ? pad(" " + str, max) : str;
}
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " Entered into Loop # " + pad(Number(bot.loopCounter) + 1, 5 ));
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " Entered into Main Loop # " + pad(Number(bot.loopCounter) + 1, 8 ));
/* For each loop we want to create a new log file. */
@@ -255,7 +255,7 @@
try {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] run -> loop -> initializeUserBot -> Entering function."); }
usertBot = USER_BOT_MODULE.newUserBot(bot, logger, COMMONS_MODULE, UTILITIES, BLOB_STORAGE);
usertBot.initialize(statusDependencies, pMonth, pYear, onInizialized);
+1
View File
@@ -66,6 +66,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="CloudUtilities.js" />
<Compile Include="User.Bot.js" />
</ItemGroup>
<ItemGroup>
<Content Include=".gitignore" />
+1 -1
View File
@@ -151,7 +151,7 @@
return str.length < max ? pad(" " + str, max) : str;
}
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " Entered into Loop # " + pad(Number(bot.loopCounter) + 1, 5));
console.log(new Date().toISOString() + " " + pad(bot.codeName, 20) + " " + pad(bot.process, 30) + " Entered into Main Loop # " + pad(Number(bot.loopCounter) + 1, 8));
/* For each loop we want to create a new log file. */