Wrap calls to console.log through LoggerUtil (prefixes).

This commit is contained in:
Daniel Scalzi
2018-08-22 14:21:49 -04:00
parent 37606dc8d2
commit 0346597afe
12 changed files with 151 additions and 103 deletions

View File

@@ -0,0 +1,28 @@
class LoggerUtil {
constructor(prefix, style){
this.prefix = prefix
this.style = style
}
log(){
console.log.apply(null, [this.prefix, this.style, ...arguments])
}
info(){
console.info.apply(null, [this.prefix, this.style, ...arguments])
}
debug(){
console.debug.apply(null, [this.prefix, this.style, ...arguments])
}
error(){
console.error.apply(null, [this.prefix, this.style, ...arguments])
}
}
module.exports = function (prefix, style){
return new LoggerUtil(prefix, style)
}