tracingChannel.subscribe(subscribers)
- 
subscribers<Object> 一组 TracingChannel 通道 订阅者¥
subscribers<Object> Set of TracingChannel Channels subscribers- 
start<Function>start事件 订阅者¥
start<Function> Thestartevent subscriber - 
end<Function>end事件 订阅者¥
end<Function> Theendevent subscriber - 
asyncStart<Function>asyncStart事件 订阅者¥
asyncStart<Function> TheasyncStartevent subscriber - 
asyncEnd<Function>asyncEnd事件 订阅者¥
asyncEnd<Function> TheasyncEndevent subscriber - 
error<Function>error事件 订阅者¥
error<Function> Theerrorevent subscriber 
 - 
 
订阅函数集合到相应通道的助手。这与在每个通道上单独调用 channel.subscribe(onMessage) 相同。
¥Helper to subscribe a collection of functions to the corresponding channels.
This is the same as calling channel.subscribe(onMessage) on each channel
individually.
import diagnostics_channel from 'node:diagnostics_channel';
const channels = diagnostics_channel.tracingChannel('my-channel');
channels.subscribe({
  start(message) {
    // Handle start message
  },
  end(message) {
    // Handle end message
  },
  asyncStart(message) {
    // Handle asyncStart message
  },
  asyncEnd(message) {
    // Handle asyncEnd message
  },
  error(message) {
    // Handle error message
  },
});const diagnostics_channel = require('node:diagnostics_channel');
const channels = diagnostics_channel.tracingChannel('my-channel');
channels.subscribe({
  start(message) {
    // Handle start message
  },
  end(message) {
    // Handle end message
  },
  asyncStart(message) {
    // Handle asyncStart message
  },
  asyncEnd(message) {
    // Handle asyncEnd message
  },
  error(message) {
    // Handle error message
  },
});