Last active
August 29, 2015 14:17
-
-
Save tusharmath/067721712be055d6c318 to your computer and use it in GitHub Desktop.
Log stack with a marker in nodejs
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
global.TimeMarker = { | |
current: process.uptime(), | |
start: function () { | |
this.current = process.uptime(); | |
}, | |
mark: function () { | |
e = new Error() | |
console.log((process.uptime() - this.current) + 's', e.stack.split('\n') | |
.slice(2, 3)[0].replace(/ *at/, '')); | |
this.start(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment