Created
April 16, 2013 19:06
-
-
Save mikelehen/5398652 to your computer and use it in GitHub Desktop.
Wraps console.log to include a timestamp (in seconds since the wrapper was initialized) with every log message.
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
console.log = (function() { | |
var console_log = console.log; | |
var timeStart = new Date().getTime(); | |
return function() { | |
var delta = new Date().getTime() - timeStart; | |
var args = []; | |
args.push((delta / 1000).toFixed(2) + ':'); | |
for(var i = 0; i < arguments.length; i++) { | |
args.push(arguments[i]); | |
} | |
console_log.apply(console, args); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment