Skip to content

Instantly share code, notes, and snippets.

@itrelease
Created August 21, 2012 10:34
Show Gist options
  • Save itrelease/3414325 to your computer and use it in GitHub Desktop.
Save itrelease/3414325 to your computer and use it in GitHub Desktop.
Console object
(function(consoleObject) {
var funcNames = [
'assert', 'count', 'debug', 'dir',
'dirxml', 'error', 'exception', 'group',
'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'time',
'timeEnd', 'trace', 'warn'
], i, funcName;
for (i=0; i<funcNames.length; i+= 1) {
funcName = funcNames[i];
consoleObject[funcName] = consoleObject[funcName] || empty;
}
function empty() {}
})(function() {
try {
console.log();
return window.console;
}
catch (e) {
return (window.console = {});
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment