Logging to console Improved

This commit is contained in:
Luis Fernando Molina committed 2019-04-06 09:46:19 +02:00
1 parent 7acce7d617
commit 16b4bdf948
2 files changed
+46 -6

No files matched your search

+21 -3
View File
@@ -313,6 +313,8 @@ Read the candles and volumes from Bruce and produce a file for each day and for
bruceStorage.getTextFile(filePath, fileName, onFileReceived, true);
console.log("[INFO] start -> buildCandles -> periodsLoop -> loopBody -> getting file at dateForPath = " + dateForPath);
function onFileReceived(err, text) {
try {
@@ -333,9 +335,19 @@ Read the candles and volumes from Bruce and produce a file for each day and for
return;
}
} else {
logger.write(MODULE_NAME, "[ERROR] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> onFileReceived -> Error Received -> err = " + err.message);
callBackFunction(err);
return;
if (err.message === 'File does not exist.') {
logger.write(MODULE_NAME, "[ERROR] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> onFileReceived -> Dependency Not Ready -> err = " + err.message);
logger.write(MODULE_NAME, "[ERROR] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> onFileReceived -> Asuming this is a temporary situation. Requesting a Retry.");
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
logger.write(MODULE_NAME, "[ERROR] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> onFileReceived -> Error Received -> err = " + err.message);
callBackFunction(err);
return;
}
}
const inputCandlesPerdiod = 60 * 1000; // 1 min
@@ -429,6 +441,8 @@ Read the candles and volumes from Bruce and produce a file for each day and for
bruceStorage.getTextFile(filePath, fileName, onFileReceived, true);
console.log("[INFO] start -> buildCandles -> periodsLoop -> loopBody -> nextVolumeFile -> getting file at dateForPath = " + dateForPath);
function onFileReceived(err, text) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> buildCandles -> periodsLoop -> loopBody -> nextVolumeFile -> onFileReceived -> Entering function."); }
@@ -592,6 +606,8 @@ Read the candles and volumes from Bruce and produce a file for each day and for
oliviaStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated);
console.log("[INFO] start -> writeFiles -> writeCandles -> creating file at filePath = " + filePath);
function onFileCreated(err) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeFiles -> writeCandles -> onFileCreated -> Entering function."); }
@@ -643,6 +659,8 @@ Read the candles and volumes from Bruce and produce a file for each day and for
oliviaStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated);
console.log("[INFO] start -> writeFiles -> writeVolumes -> creating file at filePath = " + filePath);
function onFileCreated(err) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeFiles -> writeVolumes -> onFileCreated -> Entering function."); }
+25 -3
View File
@@ -280,6 +280,8 @@
oliviaStorage.getTextFile(filePath, fileName, onFileReceived);
console.log("[INFO] start -> findPreviousContent -> loopBody -> getCandles -> getting file.");
function onFileReceived(err, text) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findPreviousContent -> loopBody -> getCandles -> onFileReceived -> Entering function."); }
@@ -320,6 +322,8 @@
oliviaStorage.getTextFile(filePath, fileName, onFileReceived);
console.log("[INFO] start -> findPreviousContent -> loopBody -> getVolumes -> getting file.");
function onFileReceived(err, text) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> findPreviousContent -> loopBody -> getVolumes -> onFileReceived -> Entering function."); }
@@ -530,6 +534,8 @@
bruceStorage.getTextFile(filePath, fileName, onFileReceived, true);
console.log("[INFO] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> getting file at dateForPath = " + dateForPath);
function onFileReceived(err, text) {
try {
@@ -550,9 +556,19 @@
return;
}
} else {
logger.write(MODULE_NAME, "[ERROR] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> onFileReceived -> Error Received -> err = " + err.message);
callBackFunction(err);
return;
if (err.message === 'File does not exist.') {
logger.write(MODULE_NAME, "[ERROR] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> onFileReceived -> Dependency Not Ready -> err = " + err.message);
logger.write(MODULE_NAME, "[ERROR] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> onFileReceived -> Asuming this is a temporary situation. Requesting a Retry.");
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
} else {
logger.write(MODULE_NAME, "[ERROR] start -> buildCandles -> periodsLoop -> loopBody -> nextCandleFile -> onFileReceived -> Error Received -> err = " + err.message);
callBackFunction(err);
return;
}
}
const inputCandlesPerdiod = 60 * 1000; // 1 min
@@ -651,6 +667,8 @@
bruceStorage.getTextFile(filePath, fileName, onFileReceived, true);
console.log("[INFO] start -> buildCandles -> periodsLoop -> loopBody -> nextVolumeFile -> getting file at dateForPath = " + dateForPath);
function onFileReceived(err, text) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> buildCandles -> periodsLoop -> loopBody -> nextVolumeFile -> onFileReceived -> Entering function."); }
@@ -797,6 +815,8 @@
oliviaStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated);
console.log("[INFO] start -> writeFiles -> writeCandles -> creating file at filePath = " + filePath);
function onFileCreated(err) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeFiles -> writeCandles -> onFileCreated -> Entering function."); }
@@ -847,6 +867,8 @@
oliviaStorage.createTextFile(filePath, fileName, fileContent + '\n', onFileCreated);
console.log("[INFO] start -> writeFiles -> writeVolumes -> creating file at filePath = " + filePath);
function onFileCreated(err) {
if (FULL_LOG === true) { logger.write(MODULE_NAME, "[INFO] start -> writeFiles -> writeVolumes -> onFileCreated -> Entering function."); }