Created
August 10, 2022 13:17
-
-
Save dataserver/253cf6c9c31b417738a1bcb53e340dcf to your computer and use it in GitHub Desktop.
js console wrapper
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
(function () { | |
var debug = true; | |
var methods = [ | |
"assert", "clear", "count", "countReset", "debug", "dir", "dirxml", "error", | |
"exception", "group", "groupCollapsed", "groupEnd", "info", "log", | |
"profile", "profileEnd", "table", "time", "timeEnd", | |
"timeLog", "timeStamp", "trace", "warn" | |
]; | |
var _cons = (window.console = window.console || {}); | |
methods.forEach(method => { | |
if (!debug) { | |
_cons[method] = function () { }; | |
} else { | |
if (!_cons[method]) { | |
_cons[method] = function () { }; | |
} | |
} | |
}); | |
window.console = _cons; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment