Skip to content

Commit 1496f3f

Browse files
committed
doc: updated wildcard debuglog example on util
1 parent a92714d commit 1496f3f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/api/util.md

+13
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ FOO 3245: hello from foo [123]
104104
where `3245` is the process id. If it is not run with that
105105
environment variable set, then it will not print anything.
106106

107+
The `section` supports wildcard also, for example:
108+
```js
109+
const util = require('util');
110+
const debuglog = util.debuglog('foo-bar');
111+
112+
debuglog('hi there, it\'s foo-bar [%d]', 2333);
113+
```
114+
115+
if it is run with `NODE_DEBUG=foo*` in the environment, then it will output something like:
116+
```txt
117+
FOO-BAR 3257: hi there, it's foo-bar [2333]
118+
```
119+
107120
Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`
108121
environment variable. For example: `NODE_DEBUG=fs,net,tls`.
109122

0 commit comments

Comments
 (0)