/** One warning or error the library detected. `code` is `owner:condition:subject`. */ export type Report = { readonly code: string; readonly level: 'warn' | 'error'; readonly message: string; readonly context?: Readonly>; readonly error?: unknown; }; /** Turns a report into the arguments a sink prints, as `console.warn(...args)` takes them. */ export type ReportFormat = (report: Report) => readonly unknown[]; /** Receives every report with the formatter's arguments. */ export type ReportSink = (report: Report, args: readonly unknown[]) => void; /** * The default formatter. The first line is * `[vapor-chamber] [ WARN ] : ` (`[ FAIL ]` for an error); in * development a `docs:` line links the code's section of docs/errors.md. An * error rides as its own argument, so the console keeps its stack. */ export declare function formatReport(report: Report): readonly unknown[]; /** The default sink: the console method of the report's level. */ export declare const consoleSink: ReportSink; /** The lowest level reported: `'warn'` reports both, `'error'` errors only, `'silent'` nothing. */ export type ReportLevel = 'warn' | 'error' | 'silent'; /** * Replace the formatter, the sinks or the level floor; an option left out, or * `null`, takes its default (`formatReport`, `[consoleSink]`, `'warn'`). An app * that adds a sink keeps `consoleSink` in its list. * * @example * configureReport({ sinks: [consoleSink, (r) => telemetry.send(r.code, r.context)] }); * configureReport({ level: 'error' }); // warnings dropped, errors reported */ export declare function configureReport(options: { format?: ReportFormat; sinks?: readonly ReportSink[]; level?: ReportLevel; } | null): void; /** * @internal Report a warning or an error. Cold: a misuse, or a throw the * library caught. A formatter's or a sink's throw prints the report and the * throw through the defaults, and the caller goes on: a reported listener * error never becomes a failed dispatch. */ export declare function _report(level: Report['level'], code: string, message: string, error?: unknown, context?: Record): void; //# sourceMappingURL=report.d.ts.map