How to print a stack trace in Node.js?

javascript, node.js, stack-trace

Solution

Any `Error` object has a `stack` member that traps the point at which it was constructed.

var stack = new Error().stack
console.log( stack )

or more simply:

console.trace("Here I am!")

Problem

Does anyone know how to print a stack trace in Node.js?

Original source

Related problems