From 1496f3f3bd1aa952ed9ca82c1aeec6ab88af9f79 Mon Sep 17 00:00:00 2001 From: Tyler Date: Fri, 15 Dec 2017 10:39:29 +0800 Subject: [PATCH] doc: updated wildcard debuglog example on util --- doc/api/util.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/api/util.md b/doc/api/util.md index 033224ba0cc16c..5502be784cd4b1 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -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`.