Console debug flag.
So you want all the advantages of logging to the console without all the headaches of IE throwing errors if you happen to forget to remove them? Easy. Override the console object and replace whatever methods being used with placeholders. If you want to debug to console, just add “?debug” to the url.
// cancel console unless "debug" exists in the url query string
console_debug = window.location.search.indexOf("debug")>=0 ? true : false;
if (!(console_debug)){
console = {};
console.log = function(){};
console.error = function(){};
}
Written by Jasson Cascante
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Console
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#