Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonukapoor/1e742b200e87b0cec59906126baa45b2 to your computer and use it in GitHub Desktop.
Save sonukapoor/1e742b200e87b0cec59906126baa45b2 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