Better Logging

This commit is contained in:
Luis Fernando Molina committed 2019-07-29 17:55:44 +02:00
1 parent 57f6fef84f
commit 2020087080
1 file changed
+17 -13
+17 -13
View File
@@ -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)
}
}