From 2020087080117f2721db5b5e6dd8073ae0bf1124 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 29 Jul 2019 17:55:44 +0200 Subject: [PATCH] Better Logging --- WebDebugLog.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/WebDebugLog.js b/WebDebugLog.js index 3888b3b82..6a758304e 100644 --- a/WebDebugLog.js +++ b/WebDebugLog.js @@ -1,17 +1,21 @@ function newWebDebugLog () { - let thisObject = { - write: write, - fileName: 'undefined' - } + try { + let thisObject = { + write: write, + fileName: 'undefined' + } - return thisObject + return thisObject - function write (pText) { - console.log(spacePad(thisObject.fileName, 50) + ' : ' + pText) + function write (pText) { + console.log(spacePad(thisObject.fileName, 50) + ' : ' + pText) - function spacePad (str, max) { - str = str.toString() - return str.length < max ? spacePad(' ' + str, max) : str - } - } -} + function spacePad (str, max) { + str = str.toString() + return str.length < max ? spacePad(' ' + str, max) : str + } + } + } catch (err) { + console.log(spacePad(MODULE_NAME, 50) + ' : ' + '[ERROR] WebDebugLog --> err = ' + err.stack) + } + }