Created
July 25, 2016 23:02
-
-
Save peanutbother/9becc3372ff963860e86a8ae269a3ce5 to your computer and use it in GitHub Desktop.
Disable console.log for on website
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
// backup console object | |
var debug = console; | |
//create Console Class | |
var Console; | |
(Console = function (showError) { | |
if (typeof showError == 'boolean') { | |
this.showError = showError; | |
} | |
}).prototype = { | |
showError: false; | |
log: function (){ | |
if(this.showError) { | |
debug.error("console is deactivated, use debug instead"); | |
} | |
} | |
} | |
/* | |
* overwrite default console object with own Class instance | |
* | |
* if object is constructed with TRUE as parameter, each usage of console.log() | |
* will raise an error to console | |
*/ | |
console = new Console(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment