-
-
Save sueblue/3e7aaef2963e375f81f98a009c94a3b7 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