import { z } from "zod";
import type { LogLevel } from "./config.ts";
/**
 * Structured fields attached to every log entry.
 *
 * Follows pino convention: flat key-value pairs merged into the
 * top-level JSON object. Nesting is allowed but discouraged —
 * prefer `module`, `action`, `carrier` over deep objects.
 */
export interface LogFields {
    [key: string]: string | number | boolean | null | undefined;
}
/**
 * Logger interface — pino-compatible.
 *
 * Every method accepts a message and optional structured fields.
 * Implementations decide formatting and transport. The interface
 * matches pino's method signatures so a pino instance can be
 * passed directly.
 *
 * ```ts
 * // Use pino directly:
 * const tc = new TauCeti({ logger: pino() });
 *
 * // Use the built-in structured logger:
 * const tc = new TauCeti({ logger: createStructuredLogger("info") });
 *
 * // Default: silent (NoOpLogger)
 * const tc = new TauCeti();
 * ```
 */
export interface Logger {
    debug(msg: string, fields?: LogFields): void;
    info(msg: string, fields?: LogFields): void;
    warn(msg: string, fields?: LogFields): void;
    error(msg: string, fields?: LogFields): void;
}
/**
 * Type guard: any object with debug/info/warn/error methods.
 * Accepts pino instances, bunyan, winston, etc.
 */
export type PinoCompatibleLogger = {
    [K in keyof Logger]: Logger[K];
};
/** Logger that discards everything. Zero overhead. */
export declare class NoOpLogger implements Logger {
    debug(): void;
    info(): void;
    warn(): void;
    error(): void;
}
/** Pino-compatible JSON log entry shape. */
export interface StructuredLogEntry {
    level: number;
    time: number;
    msg: string;
    [key: string]: unknown;
}
/**
 * Get the pino numeric level for a LogLevel string.
 */
export declare function toPinoLevel(level: LogLevel): number;
/**
 * Get the string label for a pino numeric level.
 */
export declare function fromPinoLevel(num: number): string;
/**
 * Options for StructuredLogger.
 */
export interface StructuredLoggerOptions {
    /** Minimum log level. Defaults to "info". */
    level?: LogLevel;
    /** Custom output function. Defaults to console.error (pino convention). */
    stream?: (entry: string) => void;
    /** Base fields merged into every log entry (e.g. { service: "tau-ceti" }). */
    base?: LogFields;
}
export declare const StructuredLoggerOptionsSchema: z.ZodObject<{
    level: z.ZodDefault<z.ZodEnum<{
        error: "error";
        debug: "debug";
        info: "info";
        warn: "warn";
    }>>;
    base: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodBoolean]>, z.ZodNull]>, z.ZodUndefined]>>>;
}, z.core.$strip>;
/**
 * StructuredLogger — produces pino-compatible JSON lines.
 *
 * Output format (one JSON object per line):
 * ```json
 * {"level":30,"time":1716183600000,"msg":"search completed","module":"ndc","durationMs":142}
 * ```
 *
 * - `level`: pino numeric level (20=debug, 30=info, 40=warn, 50=error)
 * - `time`: Unix epoch milliseconds
 * - `msg`: human-readable message
 * - Additional fields merged from `fields` param and `base` config
 *
 * By default writes to `console.error` (pino convention: stderr for logs,
 * stdout for data). Override with `stream` option.
 */
export declare class StructuredLogger implements Logger {
    private readonly _minLevel;
    private readonly _stream;
    private readonly _base;
    constructor(options?: Partial<StructuredLoggerOptions>);
    debug(msg: string, fields?: LogFields): void;
    info(msg: string, fields?: LogFields): void;
    warn(msg: string, fields?: LogFields): void;
    error(msg: string, fields?: LogFields): void;
    private _log;
}
/**
 * Create a structured logger with pino-compatible JSON output.
 *
 * ```ts
 * const logger = createStructuredLogger("debug");
 * logger.info("search completed", { module: "ndc", durationMs: 142 });
 * ```
 */
export declare function createStructuredLogger(level?: LogLevel, options?: Omit<Partial<StructuredLoggerOptions>, "level">): StructuredLogger;
//# sourceMappingURL=logger.d.ts.map