/*! * Copyright (c) 2026 Interop Alliance. All rights reserved. */ /** * The logging seam: the library port of the sibling logging package * (decision 0004 in its repo). This module * deliberately declares its own `Logger` type rather than importing it * (even as a type-only import) from that package, so the published * artifact -- the emitted `dist/log.d.ts` included -- carries no reference * to its specifier; the mutual-assignability check against the package's * own `Logger` type lives in `test/node/log.test.ts` instead. Call sites * elsewhere in `src/` still take it as a type-only import where useful * (enforced by the eslint `no-restricted-imports` rule); this one file is * the stated exception. * * A consumer that never calls {@link setLogger} keeps a console fallback: * same channel and level as a bare `console.*` call, but with a * `'[wallet-core]'` prefix and the call's `data` passed as a single * trailing argument (present only when supplied). An app wires a real * logger once at bootstrap, e.g. `setLogger(createLogger('wc'))`. */ /** * The structural logging port every call site in this package logs * through. Frozen at four two-arg methods (decision 0004 in the sibling * logging package's repo): a static message plus optional structured * context, with `data.err` reserved for an Error-ish value. */ export interface Logger { debug(msg: string, data?: Record): void; info(msg: string, data?: Record): void; warn(msg: string, data?: Record): void; error(msg: string, data?: Record): void; } /** * A ceremony's stage-boundary notification: called with the name of the * stage that just finished, once per stage of a long multi-stage ceremony. * Purely observational -- a caller uses it for progress display or for the * per-stage timings a latency reading needs, and this package's ceremonies * behave identically whether or not one is supplied. The names are the * ceremony's own stage vocabulary; see each ceremony's doc for its list. */ export type StageNotifier = (stage: string) => void; /** * Adapts a caller's optional {@link StageNotifier} into one every stage can * call unconditionally. An absent notifier becomes a no-op, and a THROWING * one is swallowed with a warn: telemetry must never tear a ceremony, which * would leave exactly the half-run state the notifier exists to observe. * * The optional type parameter narrows what the RETURNED notifier accepts. A * ceremony passes its own stage-name union (its exported stage tuple's * element type), so a mistyped `stage('...')` call fails the type check * instead of emitting a name no consumer displays. * * @param [onStage] {StageNotifier} * @returns {(stage: Stage) => void} */ export declare function stageNotifier(onStage?: StageNotifier): (stage: Stage) => void; /** * Installs `next` as the logger every call site in this package logs * through, and returns the PREVIOUS logger -- so a test (or an app * reconfiguring at runtime) can restore it. * * @param next {Logger} * @returns {Logger} the logger that was installed before this call. */ export declare function setLogger(next: Logger): Logger; /** * The package-wide logger. Each method forwards to whichever logger is * currently installed, so call sites bound at import time still observe a * later {@link setLogger}. */ export declare const log: Logger; //# sourceMappingURL=log.d.ts.map