SESSION.folderName implemented

This commit is contained in:
Luis Fernando Molina committed 2019-10-17 10:20:48 +02:00
1 parent b3d5c293f5
commit dba159af7a
5 files changed
+28 -10

No files matched your search

+24 -2
View File
@@ -14,12 +14,19 @@
if (FULL_LOG === true) { parentLogger.write(MODULE_NAME, "[INFO] initialize -> Entering function."); }
/* Initialize this info so that everything is logged propeerly */
bot.SESSION = {
name: bot.processNode.session.name,
id: bot.processNode.session.id,
code: bot.processNode.session.code
id: bot.processNode.session.id
}
/* Set the folderName for early logging */
if (bot.processNode.session.code.folderName === undefined) {
bot.SESSION.folderName = bot.SESSION.id
} else {
bot.SESSION.folderName = bot.processNode.session.code.folderName
}
/* Check if there is a session */
if (bot.processNode.session === undefined) {
parentLogger.write(MODULE_NAME, "[ERROR] initialize -> Cannot run without a Session.");
@@ -40,6 +47,21 @@
bot.SESSION = JSON.parse(message.event.session)
bot.UI_CURRENT_VALUES = message.event.uiCurrentValues
/* Set the folderName for logging, reports, context and data output */
let code
if (bot.SESSION.code !== undefined) {
try {
code = JSON.parse(bot.SESSION.code)
if (code.folderName === undefined) {
bot.SESSION.folderName = bot.SESSION.id
} else {
bot.SESSION.folderName = bot.processNode.session.code.folderName
}
} catch (err) {
bot.SESSION.folderName = bot.SESSION.id
}
}
setValuesToUse(message)
switch (bot.SESSION.type) {