/** * A logger function returned by {@link createDebug}. * The `enabled` property is `true` when the logger will produce output. */ export interface DebugLogger { (format: unknown, ...args: unknown[]): void; readonly enabled: boolean; } /** * Creates a namespaced logger controlled by the `DEBUG` env var. * * If `namespace` matches `DEBUG`, the logger writes to `process.stderr`; * otherwise, it is a no-op. Additionally, `logger.enabled` is `true` when * the namespace matches `DEBUG`, allowing you to conditionally run expensive * diagnostics. * * `DEBUG` should be a comma- or whitespace-separated list of patterns. * `*` is a wildcard and a leading `-` negates a pattern (e.g. * `hardhat:*,-hardhat:noisy`). * * Messages are formatted using `node:util.format`, allowing you to use format * specifiers like `%O`, `%o`, `%s`, `%d`, `%j`. Extra arguments without a * matching specifier are inspected automatically. * * Output is colorized per namespace when `stderr` is a TTY. Set * `DEBUG_COLORS=no` or `false` to disable colors. * * @example * ```ts * const log = createDebug("hardhat:utils:foo"); * log("Starting up"); * log("Received %O", payload); * log("Saved data", id, filePath); * * if (log.enabled) { * // expensive diagnostics that should only run while debugging * } * ``` * * ```sh * DEBUG="hardhat:*,-hardhat:noisy" DEBUG_COLORS=no pnpm hardhat run script.js * ``` * * @param namespace Namespace used for filtering and as the log prefix. * @returns Logger function, or a shared no-op if disabled. */ export declare function createDebug(namespace: string): DebugLogger; //# sourceMappingURL=debug.d.ts.map