Logging functionality re-written, all modules affected

This commit is contained in:
Luis Fernando Molina committed 2018-06-06 16:27:51 +02:00
1 parent dfefc0ff26
commit 2e28f86fd5
19 files changed
+1362 -1524

No files matched your search

+8 -13
View File
@@ -1,18 +1,13 @@
exports.newDataDependencies = function newDataDependencies(BOT, DEBUG_MODULE, DATA_SET, BLOB_STORAGE, UTILITIES) {
exports.newDataDependencies = function newDataDependencies(BOT, logger, DATA_SET, BLOB_STORAGE, UTILITIES) {
const FULL_LOG = true;
const LOG_FILE_CONTENT = false;
const MODULE_NAME = "DataDependencies";
const MODULE_NAME = "Data Dependencies";
let bot = BOT;
let ownerBot; // This is the bot owner of the Data Set.
const logger = DEBUG_MODULE.newDebugLog();
logger.fileName = MODULE_NAME;
logger.bot = bot;
logger.initialize();
let thisObject = {
dataSets: new Map(),
initialize: initialize,
@@ -26,7 +21,7 @@
try {
if (FULL_LOG === true) { logger.write("[INFO] initialize -> Entering function."); }
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Entering function."); }
/*
@@ -38,14 +33,14 @@
for (let i = 0; i < pDataDependenciesConfig.length; i++) {
let dataSetModule = DATA_SET.newDataSet(BOT, DEBUG_MODULE, BLOB_STORAGE, UTILITIES);
let dataSetModule = DATA_SET.newDataSet(BOT, logger, BLOB_STORAGE, UTILITIES);
dataSetModule.initialize(pDataDependenciesConfig[i], onInitilized);
function onInitilized(err) {
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write("[ERROR] initialize -> onInitilized -> err = " + err.message);
logger.write(MODULE_NAME, "[ERROR] initialize -> onInitilized -> err = " + err.message);
alreadyCalledBack = true;
callBackFunction(err);
@@ -57,7 +52,7 @@
function addDataSet() {
if (FULL_LOG === true) { logger.write("[INFO] initialize -> addDataSet -> Entering function."); }
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] initialize -> addDataSet -> Entering function."); }
addCount++;
@@ -68,7 +63,7 @@
thisObject.keys.push(key);
thisObject.dataSets.set(key, dataSetModule);
if (FULL_LOG === true) { logger.write("[INFO] initialize -> addDataSet -> DataSet added to Map. -> key = " + key); }
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] initialize -> addDataSet -> DataSet added to Map. -> key = " + key); }
if (addCount === pDataDependenciesConfig.length) {
if (alreadyCalledBack === false) {
@@ -80,7 +75,7 @@
}
} catch (err) {
logger.write("[ERROR] initialize -> err = " + err.message);
logger.write(MODULE_NAME, "[ERROR] initialize -> err = " + err.message);
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
}
}