Created
May 18, 2012 08:58
-
-
Save pincheira/2724082 to your computer and use it in GitHub Desktop.
Custom override console.log to display date on every return string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
mark