Skip to content

DebugLogger

[<Interface>]
type DebugLogger =
    abstract member enabled: bool with get, set
    abstract member Invoke (msg: string, param: obj array) : unit
AssemblyXantham.Fable.Node

Properties

abstract member enabled: bool with get, set

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]

Methods

abstract member Invoke (msg: string, param: obj array) : unit