DebugLogger interface
- Extends
Properties
| enabled | The
If this program is run with
|
Property Details
enabled
The util.debuglog().enabled getter is used to create a test that can be used
in conditionals based on the existence of the NODE_DEBUG environment variable.
If the section name appears within the value of that environment variable,
then the returned value will be true. If not, then the returned value will be
false.
import { debuglog } from 'node:util';
const enabled = debuglog('foo').enabled;
if (enabled) {
console.log('hello from foo [%d]', 123);
}
If this program is run with NODE_DEBUG=foo in the environment, then it will
output something like:
hello from foo [123]
enabled: boolean
Property Value
boolean