public
Created

Manage Debug

  • Download Gist
manage_debug.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
//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!");

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.