Specify console.trace depth

node.js

Solution

You can control how many stack frames are collected by setting the variable

Error.stackTraceLimit

Setting it to 0 will disable stack trace collection. Any finite integer value will be used as the maximum number of frames to collect. Setting it to Infinity means that all frames will be collected.

Another option is to use the command-line flag `--stack-trace-limit`:

node --stack-trace-limit=50 test.js

References:

http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi

Problem

Is there a way of specify stack trace depth when using console.trace? I would find this particularly useful for info and log level messages to identify line number and file

Original source