From adca0b8d9e7258cd55112ea9afe6367e26f4cde9 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 16 Sep 2018 11:56:18 +0200 Subject: [PATCH] Logging Improved --- Root.js | 4 ++++ Run.js | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Root.js b/Root.js index 2e689d2a0..3a9e5a8ed 100644 --- a/Root.js +++ b/Root.js @@ -146,6 +146,8 @@ exports.newRoot = function newRoot() { function onInizialized(err) { + console.log(logDisplace + "Root : [INFO] initialize -> onInizialized -> Entering function. "); + if (err.result === global.DEFAULT_OK_RESPONSE.result) { let filePath; @@ -170,6 +172,8 @@ exports.newRoot = function newRoot() { function onFileReceived(err, text) { + console.log(logDisplace + "Root : [INFO] initialize -> onInizialized -> onFileReceived -> Entering function. "); + if (err.result !== global.DEFAULT_OK_RESPONSE.result) { console.log(logDisplace + "Root : [INFO] initialize -> onInizialized -> onFileReceived -> err = " + err.message); return; diff --git a/Run.js b/Run.js index 4911e433d..23f632705 100644 --- a/Run.js +++ b/Run.js @@ -39,6 +39,8 @@ function readStoragePermissions() { let filePath; try { + console.log( "[INFO] Run -> readStoragePermissions -> Entering function. "); + let fs = require('fs'); filePath = '../' + 'User-Profile' + '/' + 'User.Profile.json'; global.USER_PROFILE = JSON.parse(fs.readFileSync(filePath, 'utf8')); @@ -61,8 +63,8 @@ function readStoragePermissions() { readEmailConfiguration(); } catch (err) { - console.log("[ERROR] readStoragePermissions -> err = " + err.message); - console.log("[HINT] readStoragePermissions -> You need to have a file at this path -> " + filePath); + console.log("[ERROR] Run -> readStoragePermissions -> err = " + err.message); + console.log("[HINT] Run -> readStoragePermissions -> You need to have a file at this path -> " + filePath); } } @@ -71,6 +73,8 @@ function readEmailConfiguration() { let filePath; try { + console.log( "Run : [INFO] readEmailConfiguration -> Entering function. "); + let fs = require('fs'); filePath = '../' + 'Email-Config' + '/' + 'Email.Config.json'; global.EMAIL_CONFIG = JSON.parse(fs.readFileSync(filePath, 'utf8')); @@ -78,14 +82,16 @@ function readEmailConfiguration() { readExchangeAPIKey(); } catch (err) { - console.log("[ERROR] readEmailConfiguration -> err = " + err.message); - console.log("[HINT] You need to have a file at this path -> " + filePath); + console.log("[ERROR] Run -> readEmailConfiguration -> err = " + err.message); + console.log("[HINT] Run -> You need to have a file at this path -> " + filePath); } } function readExchangeAPIKey() { try { + console.log( "[INFO] Run -> readExchangeAPIKey -> Entering function. "); + let fs = require('fs'); let filePath = '../' + 'Exchange-Keys' + '/' + 'Secret.Keys' + '.json'; @@ -93,8 +99,8 @@ function readExchangeAPIKey() { startRoot(); } catch (err) { - console.log("[ERROR] readExchangeAPIKey -> err = " + err.message); - console.log("[HINT] You need to have a file at this path -> " + filePath); + console.log("[ERROR] Run -> readExchangeAPIKey -> err = " + err.message); + console.log("[HINT] Run -> You need to have a file at this path -> " + filePath); global.EXCHANGE_KEYS = { Poloniex: [{ @@ -109,6 +115,8 @@ function readExchangeAPIKey() { function startRoot() { + console.log( "[INFO] Run -> startRoot -> Entering function. "); + const ROOT_DIR = './'; const ROOT_MODULE = require(ROOT_DIR + 'Root'); let root = ROOT_MODULE.newRoot(); @@ -125,6 +133,8 @@ function startRoot() { function onInitialized() { + console.log( "[INFO] Run -> startRoot -> onInitialized -> Entering function. "); + root.start(); } }