Skip to content

Commit

Permalink
doc: updated wildcard debuglog example on util
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerYang committed Dec 15, 2017
1 parent a92714d commit 1496f3f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/api/util.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ FOO 3245: hello from foo [123]
where `3245` is the process id. If it is not run with that
environment variable set, then it will not print anything.

The `section` supports wildcard also, for example:
```js
const util = require('util');
const debuglog = util.debuglog('foo-bar');

debuglog('hi there, it\'s foo-bar [%d]', 2333);
```

if it is run with `NODE_DEBUG=foo*` in the environment, then it will output something like:
```txt
FOO-BAR 3257: hi there, it's foo-bar [2333]
```

Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`
environment variable. For example: `NODE_DEBUG=fs,net,tls`.

Expand Down

0 comments on commit 1496f3f

Please sign in to comment.