Skip to content

Instantly share code, notes, and snippets.

@pingyen
Last active December 11, 2015 04:38
Show Gist options
  • Select an option

  • Save pingyen/4546347 to your computer and use it in GitHub Desktop.

Select an option

Save pingyen/4546347 to your computer and use it in GitHub Desktop.
JavaScript Console Customization
(function() {
var arr = ['log', 'error', 'info', 'warn', 'trace'],
n = arr.length;
for(var i = 0; i < n; ++i) {
(function(k) {
var f = console[k];
console[k] = function() {
var arr = Array.prototype.slice.call(arguments);
arr.push(k, new Date());
f.apply(this, arr);
}
})(arr[i]);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment