Skip to main content
Tracing - trace_events - Node documentation
interface Tracing

Usage in Deno

import { type Tracing } from "node:trace_events";

Deno compatibility

This symbol is a non-functional stub.

The Tracing object is used to enable or disable tracing for sets of categories. Instances are created using the trace_events.createTracing() method.

When created, the Tracing object is disabled. Calling the tracing.enable() method adds the categories to the set of enabled trace event categories. Calling tracing.disable() will remove the categories from the set of enabled trace event categories.

Properties

readonly
categories: string

A comma-separated list of the trace event categories covered by this Tracing object.

readonly
enabled: boolean

true only if the Tracing object has been enabled.

Methods

disable(): void

Disables this Tracing object.

Only trace event categories not covered by other enabled Tracing objects and not specified by the --trace-event-categories flag will be disabled.

import trace_events from 'node:trace_events';
const t1 = trace_events.createTracing({ categories: ['node', 'v8'] });
const t2 = trace_events.createTracing({ categories: ['node.perf', 'node'] });
t1.enable();
t2.enable();

// Prints 'node,node.perf,v8'
console.log(trace_events.getEnabledCategories());

t2.disable(); // Will only disable emission of the 'node.perf' category

// Prints 'node,v8'
console.log(trace_events.getEnabledCategories());
enable(): void

Enables this Tracing object for the set of categories covered by the Tracing object.

Back to top