Skip to content

Instantly share code, notes, and snippets.

@ryansukale
Created May 14, 2013 05:57
Show Gist options
  • Save ryansukale/5573994 to your computer and use it in GitHub Desktop.
Save ryansukale/5573994 to your computer and use it in GitHub Desktop.
var logEnabled = true;
//Hack for IE. The window.console object is not available until the
//console window has been opened at least once
//Associated stackoverflow post - http://stackoverflow.com/questions/10961430/ie9-not-running-javascript-onload/12924439#12924439
if(!window.console){
console={};
console.log = function(){};
}
//-------Enable or disable javascript logging
var originaLog = window.console.log;
window.console.log = function(param){
if(logEnabled){
//window.console[originaLog].apply(this,arguments);
originaLog.apply(this,arguments);
}
}
//------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment