You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: locale/en/blog/release/v14.17.0.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,8 @@ to enable testing it at a larger scale.
20
20
With `diagnostics_channel`, Node.js core and module authors can publish contextual data about what they are doing at a given time. This could be the hostname and query string of a mysql query, for example. Just create a named channel with `dc.channel(name)` and call `channel.publish(data)` to send the data to any listeners to that channel.
Channels are like one big global event emitter but are split into separate objects to ensure they get the best performance. If nothing is listening to the channel, the publishing overhead should be as close to zero as possible. Consuming channel data is as easy as using `channel.subscribe(listener)` to run a function whenever a message is published to that channel.
38
38
39
39
```js
40
-
constdc=require('diagnostics_channel');
41
-
constchannel=dc.channel('mysql.query');
40
+
constdc=require("diagnostics_channel");
41
+
constchannel=dc.channel("mysql.query");
42
42
43
43
channel.subscribe(({ query, host }) => {
44
44
console.log(`mysql query to ${host}: ${query}`);
@@ -55,7 +55,7 @@ The new `crypto.randomUUID()` method now allows to generate random
55
55
[RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) Version 4 UUID strings:
Copy file name to clipboardExpand all lines: locale/en/blog/release/v15.1.0.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,8 @@ author: Michaël Zasso
17
17
With `diagnostics_channel`, Node.js core and module authors can publish contextual data about what they are doing at a given time. This could be the hostname and query string of a mysql query, for example. Just create a named channel with `dc.channel(name)` and call `channel.publish(data)` to send the data to any listeners to that channel.
Channels are like one big global event emitter but are split into separate objects to ensure they get the best performance. If nothing is listening to the channel, the publishing overhead should be as close to zero as possible. Consuming channel data is as easy as using `channel.subscribe(listener)` to run a function whenever a message is published to that channel.
35
35
36
36
```js
37
-
constdc=require('diagnostics_channel');
38
-
constchannel=dc.channel('mysql.query');
37
+
constdc=require("diagnostics_channel");
38
+
constchannel=dc.channel("mysql.query");
39
39
40
40
channel.subscribe(({ query, host }) => {
41
41
console.log(`mysql query to ${host}: ${query}`);
@@ -67,11 +67,11 @@ systems.
67
67
The resolver will use the v4 local address when making requests to IPv4 DNS servers, and the v6 local address when making requests to IPv6 DNS servers.
68
68
69
69
```js
70
-
const { Resolver } =require('dns');
70
+
const { Resolver } =require("dns");
71
71
72
72
constresolver=newResolver();
73
73
74
-
resolver.setLocalAddress('10.1.2.3');
74
+
resolver.setLocalAddress("10.1.2.3");
75
75
// Equivalent to: resolver.setLocalAddress('10.1.2.3', '::0');
0 commit comments