New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

instrument

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

instrument

Tool to capture calls to Node.js native modules

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Instrument

npm node-current GitHub license PRs Welcome Language grade: JavaScript

A tool that collects information about calls made to Node.js native modules.

Installation

To add it as a development dependency run:

npm i instrument --save-dev

Usage

Loading it programatically (using default configuration):

require('instrument')()

You can also include it by using the -r or --require flag in your command:

$ node -r instrument/config my-app.js

Configuration

instrument accepts a configuration object if it's being loaded programatically or you could create a instrument.config.js file in case you're including it via the --require flag.

Example of a instrument.config.js file:

module.exports = {
  summary: true,
  frequency: true,
  output: 'my-instrumentation-logs.txt'
}

Configuration properties

dependencies

Specifies if dependencies should be instrumented. Default value is false.

summary

Enable this property to print a summary of the instrumented calls that were captured. Default value is true.

structured

It changes the log output to be JSON formatted. Default value is false.

frequency

In case "summary" property is set to true, then also prints a frequency indicator for each call.

output

If you want to avoid printing the output to stdout you can specify a file to be used for logging.

modules

It accepts an array of the native modules you want to be instrumented. Default values are ["child_process","http","https","fs","require"].

runtimeLogs

Enables or disables the logging at runtime for instrumented calls. Default value is false.

License

MIT

Keywords

FAQs

Package last updated on 01 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc