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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With