Exports
[<Class>]
type Exports =
static member createTracing (options: CreateTracingOptions) : Tracing
static member getEnabledCategories () : string option| Assembly | Xantham.Fable.Node |
| Attributes | [<Erase>] |
The package's value exports, each bound to its import.
Methods
static member createTracing (options: CreateTracingOptions) : Tracing
static member createTracing (options: CreateTracingOptions) : TracingCreates and returns a Tracing object for the given set of categories.
import trace_events from 'node:trace_events';
const categories = ['node.perf', 'node.async_hooks'];
const tracing = trace_events.createTracing({ categories });
tracing.enable();
// do stuff
tracing.disable();
@since v10.0.0
static member getEnabledCategories () : string option
static member getEnabledCategories () : string optionReturns a comma-separated list of all currently-enabled trace event categories. The current set of enabled trace event categories is determined by the union of all currently-enabled Tracing objects and any categories enabled using the --trace-event-categories flag.
Given the file test.js below, the command node --trace-event-categories node.perf test.js will print 'node.async_hooks,node.perf' to the console.
import trace_events from 'node:trace_events';
const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
const t2 = trace_events.createTracing({ categories: ['node.perf'] });
const t3 = trace_events.createTracing({ categories: ['v8'] });
t1.enable();
t2.enable();
console.log(trace_events.getEnabledCategories());
@since v10.0.0