开发者社区> 镜像站> NPM> ah-stack-capturer
ah-stack-capturer
Captures async hook stack traces for specific resource types and events.
Last updated 4 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ah-stack-capturer 
SYNC missed versions from official npm registry.

ah-stack-capturer build status

Captures async hook stack traces for specific resource types and events.

const capturer = StackCapturer.forAllEvents()
capturer.shouldCapture('init') // => true
const stack = capturer.captureStack()
const processed = capturer.processStack()

Installation

npm install ah-stack-capturer

API

constructor

Creates StackCapturere instance. Either shouldCapture OR events with optional types need to be supplied.

Parameters

  • $0 Object
    • $0.events (optional, default if)
    • $0.types (optional, default !=)
    • $0.shouldCapture (optional, default s !=)

stackCapturer.shouldCaptureStack

Returns true|false indicating if a stack should be captured according to the options passed in the @constructor.

Parameters

  • event String the async hook event (init|before|after|destroy)
  • type String the type of async resource that triggered the event

Returns Boolean true or false indicating if a stack should be captured

stackCapturer.captureStack

Captures the current stack.

Returns String the current stack

stackCapturer.processStack

Processes the supplied stack by splitting the string into lines and removing those that are part of the async hook execution itself.

This allows the user to focus only on the relevant stack.

Parameters

  • stack String the captured stack

Returns Array<String> the processed stack

StackCapturer.forAllEvents

Creates a StackCapturer that captures ALL events for the supplied types.

Parameters

  • types Set<String>? types passed to the StackCapturer constructor

StackCapturer.turnedOff

Creates a StackCapturer that captures nothing.

License

MIT

Current Tags

  • 1.1.0                                ...           latest (4 years ago)

2 Versions

  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)
Dependents (3)