Skip to content

Instantly share code, notes, and snippets.

@sueblue
Forked from pincheira/gist:2724082
Created January 17, 2019 08:07
Show Gist options
  • Save sueblue/3e7aaef2963e375f81f98a009c94a3b7 to your computer and use it in GitHub Desktop.
Save sueblue/3e7aaef2963e375f81f98a009c94a3b7 to your computer and use it in GitHub Desktop.
Custom override console.log to display date on every return string
function showDate(){
var date = new Date(),
str = date.toUTCString();
return str;
}
var orig = console.log;
console.log = function() {
var msgs = [];
while(arguments.length) {
msgs.push("[" + showDate() + "]" + ': ' + [].shift.call(arguments));
}
orig.apply(console, msgs);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment