Skip to main content
getEnabledCategories - trace_events - Node documentation
function getEnabledCategories

Usage in Deno

import { getEnabledCategories } from "node:trace_events";
getEnabledCategories(): string | undefined
Deno compatibility

This symbol is a non-functional stub.

Returns 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());

Return Type

string | undefined