Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Capture function calls and verbose stacktraces
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.npmignore
.travis.yml
README.md
calltrace.js
package.json

README.md

CallTrace build status NPM version

Install with npm

$ npm install calltrace

Usage

var trace = require( 'calltrace' )

Calltrace will emit capture events, keep in mind to bind to them:

trace.on( 'capture', function( info ) {
  console.log( info )
})

Where the info will consist of an object with the following properties:

  • 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:

trace.capture( 'require' ) // OR
trace.capture( 'require.resolve' )

Or, if you want to keep an eye on a method you only have access to in this scope:

trace.capture( someObject.subPath, 'methodName' )

Also, in case you want to turn off stack trace capturing, pass false as last parameter to capture():

trace.capture( 'fn', false ) // OR
trace.capture( bla, 'methodName', false )
Something went wrong with that request. Please try again.