Skip to content

Instantly share code, notes, and snippets.

@chrisyip
Created May 16, 2015 16:24
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 chrisyip/1d38a18ff5028399fd20 to your computer and use it in GitHub Desktop.
Save chrisyip/1d38a18ff5028399fd20 to your computer and use it in GitHub Desktop.
console.trace
// http://stackoverflow.com/questions/6715571/how-to-get-result-of-console-trace-as-string-in-javascript-with-chrome-or-fire
function getStackTrace () {
var obj = {}
// Remove arguments.callee from trace list
Error.captureStackTrace(obj, getStackTrace)
return obj.stack
}
console.log(getStackTrace())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment