Skip to content

Instantly share code, notes, and snippets.

@kanngard
Forked from sillero/gist:4345292
Last active August 29, 2015 14:01
Show Gist options
  • Save kanngard/33a3f1fcd5b19f1f28ef to your computer and use it in GitHub Desktop.
Save kanngard/33a3f1fcd5b19f1f28ef to your computer and use it in GitHub Desktop.
Safe JavaScript console polyfill, JSHint mods
/**
* Console-polyfill. MIT license.
* Modified from https://github.com/paulmillr/console-polyfill
* Make it safe to do console.log() always.
*/
(function(con) {
var dummy = con.log || function() {}
for (var methods = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","), func;
(func = methods.pop()) !== undefined;) {
con[func] = con[func] || dummy;
}
}(window.console = window.console || {}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment