import { InjectionToken } from './di'; /** Log severity, low to high. */ export type LogLevel = 'debug' | 'info' | 'warn' | 'error'; /** A structured log record: level, message, time, request id, and any fields. */ export interface LogRecord { /** Severity of the record. */ level: LogLevel; /** Human-readable event message; keep it stable and put variable data in the free-form fields below. */ msg: string; /** ISO-8601 timestamp of when the record was emitted. */ time: string; /** Correlation id of the request that produced it, when inside one. */ requestId?: string; /** Arbitrary structured fields merged into the record. */ [key: string]: unknown; } /** Consumes each emitted record (already past the level filter); called synchronously, once per record. */ export type LogSink = (record: LogRecord) => void; /** Override where log records go (default: JSON to stdout, warn/error to stderr). */ export declare const LOG_SINK: InjectionToken; /** Override the minimum level (default: `LOG_LEVEL` env, else `"info"`). */ export declare const LOG_LEVEL: InjectionToken; /** * Structured, injectable logger. Quiet by default — only records at or above the * minimum level (`info` unless `LOG_LEVEL` says otherwise) are emitted — and, * when the {@link requestId} plugin is active, each record emitted inside a * request is stamped with its id, so logs correlate to requests with no per-call * plumbing. * * ```ts * class Orders { * private log = inject(Logger) * place() { this.log.info('order placed', { total: 42 }) } * } * ``` * * Records are JSON to stdout (warnings/errors to stderr) by default; bind a * `LOG_SINK` provider to route them elsewhere (a file, a collector, a test spy). */ export declare class Logger { private readonly sink; private readonly min; private write; /** * Log at `debug` — the lowest level, dropped unless the minimum is `debug`. * * @param msg - Event message; becomes the record's `msg` field. * @param fields - Structured fields; merged last, so keys `level`/`msg`/`time`/`requestId` here override the built-ins. */ debug(msg: string, fields?: Record): void; /** * Log at `info` — the default minimum level; goes to stdout via the default sink. * * @param msg - Event message; becomes the record's `msg` field. * @param fields - Structured fields; merged last, so keys `level`/`msg`/`time`/`requestId` here override the built-ins. */ info(msg: string, fields?: Record): void; /** * Log at `warn` — routed to stderr (not stdout) by the default sink. * * @param msg - Event message; becomes the record's `msg` field. * @param fields - Structured fields; merged last, so keys `level`/`msg`/`time`/`requestId` here override the built-ins. */ warn(msg: string, fields?: Record): void; /** * Log at `error` — the highest level; routed to stderr by the default sink. * * @param msg - Event message; becomes the record's `msg` field. * @param fields - Structured fields; merged last, so keys `level`/`msg`/`time`/`requestId` here override the built-ins. Pass a caught error under a field (e.g. `{ err }`) rather than as `msg`. */ error(msg: string, fields?: Record): void; } //# sourceMappingURL=logger.d.ts.map