Created
August 2, 2019 15:31
-
-
Save w35l3y/1d4e5578f7ce9d2a3d434729585defa6 to your computer and use it in GitHub Desktop.
Estrutura genérica para tratamento de log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// depends on https://gist.github.com/w35l3y/07442c6adf297703ac7915526a980134 | |
function Logger (script) { | |
var debug = script.debug; | |
this.debug = function () { | |
if (debug) { | |
console.debug.apply(null, arguments); | |
alert(Array.prototype.slice.apply(arguments).join("\n\n")); | |
} | |
}; | |
this.info = function () { | |
debug && console.log.apply(null, arguments); | |
}; | |
this.warn = function () { | |
console.warn.apply(null, arguments); | |
debug && alert(Array.prototype.slice.apply(arguments).join("\n\n")); | |
}; | |
this.error = function () { | |
console.error.apply(null, arguments); | |
alert(Array.prototype.slice.apply(arguments).join("\n\n")); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment