Cleaning Conditional Logs part 2
This commit is contained in:
1 parent
cf0529ae3c
commit
c691740882
4 files changed
+9
-50
No files matched your search
@@ -1,8 +1,6 @@
|
||||
|
||||
exports.newCloudUtilities = function newCloudUtilities(logger) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
|
||||
const MODULE_NAME = "Cloud Utilities";
|
||||
|
||||
let utilities = {
|
||||
@@ -16,9 +14,7 @@ exports.newCloudUtilities = function newCloudUtilities(logger) {
|
||||
function createFolderIfNeeded(path, azureFileStorage, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] createFolderIfNeeded -> Entering function."); }
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] createFolderIfNeeded -> path = " + path); }
|
||||
logger.write(MODULE_NAME, "[INFO] createFolderIfNeeded -> path = " + path)
|
||||
|
||||
let splittedPath = path.split("/");
|
||||
|
||||
@@ -29,36 +25,26 @@ exports.newCloudUtilities = function newCloudUtilities(logger) {
|
||||
loop();
|
||||
|
||||
function loop() {
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] createFolderIfNeeded -> path = " + path); }
|
||||
logger.write(MODULE_NAME, "[INFO] createFolderIfNeeded -> path = " + path)
|
||||
|
||||
partialPath = partialPath + separator + splittedPath[i];
|
||||
separator = "/";
|
||||
|
||||
i++;
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] createFolderIfNeeded -> partialPath = " + partialPath); }
|
||||
logger.write(MODULE_NAME, "[INFO] createFolderIfNeeded -> partialPath = " + partialPath)
|
||||
|
||||
azureFileStorage.createFolder(partialPath, checkLoop);
|
||||
|
||||
function checkLoop(err) {
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] createFolderIfNeeded -> loop -> checkLoop -> Entering function."); }
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
logger.write(MODULE_NAME, "[ERROR] createFolderIfNeeded -> loop -> checkLoop -> err = "+ err.stack);
|
||||
logger.write(MODULE_NAME, "[ERROR] createFolderIfNeeded -> loop -> checkLoop -> err = " + err.stack);
|
||||
callBackFunction(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (i === splittedPath.length) {
|
||||
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE);
|
||||
|
||||
} else {
|
||||
|
||||
loop();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
exports.newCommons = function newCommons(bot, logger, UTILITIES, FILE_STORAGE) {
|
||||
|
||||
const FULL_LOG = true;
|
||||
const LOG_FILE_CONTENT = false;
|
||||
|
||||
const MODULE_NAME = "Commons";
|
||||
|
||||
let thisObject = {
|
||||
@@ -454,9 +451,6 @@
|
||||
function generateFileContent(records, recordDefinition, resultsWithIrregularPeriods, processingDailyFiles, currentDay, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> generateFileContent -> Entering function."); }
|
||||
|
||||
let fileContent = "";
|
||||
let recordSeparator = "";
|
||||
|
||||
@@ -519,9 +513,6 @@
|
||||
function writeFile(contextSummary, fileContent, anotherFileWritten, processingDailyFiles, timeFrameLabel, currentDay, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeFile -> Entering function."); }
|
||||
|
||||
let market = bot.market;
|
||||
let fileName = 'Data.json';
|
||||
let dateForPath = ''
|
||||
@@ -539,10 +530,6 @@
|
||||
function onFileCreated(err) {
|
||||
|
||||
try {
|
||||
|
||||
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeFile -> onFileCreated -> Entering function."); }
|
||||
if (LOG_FILE_CONTENT === true) { logger.write(MODULE_NAME, "[INFO] start -> writeFile -> onFileCreated -> fileContent = " + fileContent); }
|
||||
|
||||
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
|
||||
|
||||
logger.write(MODULE_NAME, "[ERROR] start -> writeFile -> onFileCreated -> err = " + err.stack);
|
||||
|
||||
+5
-18
@@ -25,7 +25,7 @@ exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
try {
|
||||
thisObject.node = dataDependency.referenceParent;
|
||||
logger.fileName = MODULE_NAME
|
||||
|
||||
|
||||
/* Some very basic validations that we have all the information needed. */
|
||||
if (thisObject.node === undefined) {
|
||||
logger.write(MODULE_NAME, "[ERROR] initialize -> Data Dependency without Reference Parent -> dataDependency = " + JSON.stringify(dataDependency));
|
||||
@@ -87,13 +87,13 @@ exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
if (networkNode === undefined) {
|
||||
logger.write(MODULE_NAME, "[WARN] initialize -> Network Node not found.")
|
||||
logger.write(MODULE_NAME, "[WARN] initialize -> Initialization Failed because we could not find where the data of this dataset is located within the network. Check the logs for more info.");
|
||||
logger.write(MODULE_NAME, "[WARN] initialize -> Could not find where " + datasetProductDefinition.name + " for " + bot.exchange + " " + bot.market.baseAsset + "/" + bot.market.quotedAsset + " is stored within the network.");
|
||||
logger.write(MODULE_NAME, "[WARN] initialize -> Could not find where " + datasetProductDefinition.name + " for " + bot.exchange + " " + bot.market.baseAsset + "/" + bot.market.quotedAsset + " is stored within the network.");
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE, false);
|
||||
return
|
||||
}
|
||||
|
||||
/* We found where the data is located on the network. */
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] initialize -> Retrieving data from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.'); }
|
||||
logger.write(MODULE_NAME, "[INFO] initialize -> Retrieving data from " + networkNode.name + " -> host = " + networkNode.config.host + ' -> port = ' + networkNode.config.webPort + '.')
|
||||
|
||||
fileStorage = FILE_STORAGE.newFileStorage(logger, networkNode.config.host, networkNode.config.webPort);
|
||||
callBackFunction(global.DEFAULT_OK_RESPONSE, true);
|
||||
@@ -114,9 +114,6 @@ exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
function getTextFile(pFolderPath, pFileName, callBackFunction) {
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] getTextFile -> Entering function."); }
|
||||
|
||||
let mine = thisObject.node.parentNode.parentNode.parentNode.config.codeName
|
||||
let mineType = thisObject.node.parentNode.parentNode.parentNode.type.replace(' ', '-')
|
||||
let project = thisObject.node.parentNode.parentNode.parentNode.project
|
||||
@@ -129,11 +126,7 @@ exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
fileStorage.getTextFile(filePath, onFileReceived);
|
||||
|
||||
function onFileReceived(err, text) {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] getTextFile -> onFileReceived -> Entering function."); }
|
||||
|
||||
callBackFunction(err, text);
|
||||
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
@@ -146,9 +139,8 @@ exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
|
||||
try {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] createTextFile -> Entering function."); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] createTextFile -> pFolderPath = " + pFolderPath); }
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] createTextFile -> pFileName = " + pFileName); }
|
||||
logger.write(MODULE_NAME, "[INFO] createTextFile -> pFolderPath = " + pFolderPath)
|
||||
logger.write(MODULE_NAME, "[INFO] createTextFile -> pFileName = " + pFileName)
|
||||
|
||||
let ownerId = thisObject.node.dataMine + "-" + thisObject.node.bot
|
||||
let botId = bot.dataMine + "-" + bot.codeName
|
||||
@@ -170,11 +162,7 @@ exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
fileStorage.createTextFile(filePath, pFileContent, onFileCreated);
|
||||
|
||||
function onFileCreated(err) {
|
||||
|
||||
if (global.LOG_CONTROL[MODULE_NAME].logInfo === true) { logger.write(MODULE_NAME, "[INFO] createTextFile -> onFileCreated -> Entering function."); }
|
||||
|
||||
callBackFunction(err);
|
||||
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
@@ -182,5 +170,4 @@ exports.newDataSet = function newDataSet(BOT, logger) {
|
||||
callBackFunction(global.DEFAULT_FAIL_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,7 +1,6 @@
|
||||
exports.newLearningSession = function newLearningSession(bot, parentLogger) {
|
||||
|
||||
const MODULE_NAME = "Learning Session"
|
||||
const FULL_LOG = true;
|
||||
|
||||
let thisObject = {
|
||||
initialize: initialize
|
||||
|
||||
Reference in new issue
Block a user