Skip to content

Instantly share code, notes, and snippets.

@marcteys
Last active January 8, 2016 14:06
Show Gist options
  • Save marcteys/9239265c6e9e39a0d733 to your computer and use it in GitHub Desktop.
Save marcteys/9239265c6e9e39a0d733 to your computer and use it in GitHub Desktop.
Override console.log
//GlobalDebug(true||false);
var GlobalDebug = (function () {
var savedConsole = console;
return function(debugOn,suppressAll){
var suppress = suppressAll || false;
if (debugOn === false) {
console = {};
console.log = function () { };
if(suppress) {
console.info = function () { };
console.warn = function () { };
console.error = function () { };
} else {
console.info = savedConsole.info;
console.warn = savedConsole.warn;
console.error = savedConsole.error;
}
} else {
console = savedConsole;
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment