hasSubscribers

true if any of the individual channels has a subscriber, false if not.

This is a helper method available on a {@link TracingChannel} instance to check if any of the TracingChannel Channels have subscribers. A true is returned if any of them have at least one subscriber, a false is returned otherwise.

const diagnostics_channel = require('node:diagnostics_channel');

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

if (channels.hasSubscribers) {
// Do something
}

Since

v22.0.0, v20.13.0