Skip to main content
tracingChannel - diagnostics_channel - Node documentation
function tracingChannel
Unstable

Usage in Deno

import { tracingChannel } from "node:diagnostics_channel";
tracingChannel<
StoreType = unknown,
ContextType extends object = StoreType extends object ? StoreType : object,
>
(nameOrChannels: string | TracingChannelCollection<StoreType, ContextType>): TracingChannel<StoreType, ContextType>

Creates a TracingChannel wrapper for the given TracingChannel Channels. If a name is given, the corresponding tracing channels will be created in the form of tracing:${name}:${eventType} where eventType corresponds to the types of TracingChannel Channels.

import diagnostics_channel from 'node:diagnostics_channel';

const channelsByName = diagnostics_channel.tracingChannel('my-channel');

// or...

const channelsByCollection = diagnostics_channel.tracingChannel({
  start: diagnostics_channel.channel('tracing:my-channel:start'),
  end: diagnostics_channel.channel('tracing:my-channel:end'),
  asyncStart: diagnostics_channel.channel('tracing:my-channel:asyncStart'),
  asyncEnd: diagnostics_channel.channel('tracing:my-channel:asyncEnd'),
  error: diagnostics_channel.channel('tracing:my-channel:error'),
});

Type Parameters

StoreType = unknown
ContextType extends object = StoreType extends object ? StoreType : object

Parameters

nameOrChannels: string | TracingChannelCollection<StoreType, ContextType>

Channel name or object containing all the TracingChannel Channels

Return Type

Collection of channels to trace with