Skip to content

Instantly share code, notes, and snippets.

@tusharmath
Last active August 29, 2015 14:17
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 tusharmath/067721712be055d6c318 to your computer and use it in GitHub Desktop.
Save tusharmath/067721712be055d6c318 to your computer and use it in GitHub Desktop.
Log stack with a marker in nodejs
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