Skip to content

Instantly share code, notes, and snippets.

@egm0121
Created May 7, 2014 08:28
Show Gist options
  • Save egm0121/d8a48d137b215b11b74f to your computer and use it in GitHub Desktop.
Save egm0121/d8a48d137b215b11b74f to your computer and use it in GitHub Desktop.
hide console.log in prod
!function(a,b){var c,d={},e=function(){},f=function(){d.history=d.history||[],d.history.push(arguments),this.console&&original.log(Array.prototype.slice.call(arguments))},g=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],h=g.length,i=window.console=window.console||{};try{for(;h--;)c=g[h],i[c]="log"==c?f:e}catch(j){}b._unlockConsole=function(){i.log=a,d.history.map(function(a){i.log.apply(i,Array.prototype.slice.call(a))})}}(null!=console&&"object"==typeof console&&"log"in console?console.log:function(){},this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment