Skip to content

Instantly share code, notes, and snippets.

@pingyen

pingyen/jsConsoleCustom.js

Last active Dec 11, 2015
Embed
What would you like to do?
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