Skip to content

Instantly share code, notes, and snippets.

@aziz
Created July 30, 2011 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aziz/1115388 to your computer and use it in GitHub Desktop.
Save aziz/1115388 to your computer and use it in GitHub Desktop.
Manage Debug
//Call this function after body load
function manageDebug(){
var debug = false;
if(window.console){
var consoleBackUp = window.console.log;
window.console.log = function(str){
if(debug){
consoleBackUp.call(this,str);
}
}
}else{
var log = window.opera ? window.opera.postError : alert;
window.console = {};
window.console.log = function(str){
if(debug){
log(str);
}
}
}
} //manageDebug ends
manageDebug();
console.log("This works!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment