Capture function calls and verbose stacktraces
Install with npm
$ npm install calltrace
var trace = require 'calltrace'
Calltrace will emit
capture events, keep in mind to bind to them:
traceon 'capture'console.log info
info will consist of an object with the following
- String name: name of captured function
- Function fn: original (replaced) function,
- Array argv: array of arguments passed into the function
- Number time: milliseconds spent int the function
- Object stack: verbose stack trace, if enabled
In case you want to monitor a globally available function:
tracecapture 'require' // ORtracecapture 'require.resolve'
Or, if you want to keep an eye on a method you only have access to in this scope:
tracecapture someObjectsubPath 'methodName'
Also, in case you want to turn off stack trace capturing,
false as last parameter to
tracecapture 'fn' false // ORtracecapture bla 'methodName' false