export interface LogParams { module: string; message: string; args?: Record; } export type ErrorLogParams = LogParams & { err: Error; }; export type WarnLogParams = LogParams & { err?: Error; }; export interface Logger { trace(params: LogParams): void; debug(params: LogParams): void; info(params: LogParams): void; warn(params: WarnLogParams): void; error(params: ErrorLogParams): void; } export declare class DefaultLogger implements Logger { trace({ module, message, args }: LogParams): void; debug({ module, message, args }: LogParams): void; info({ module, message, args }: LogParams): void; warn({ module, message, args, err }: WarnLogParams): void; error({ module, message, args, err }: ErrorLogParams): void; } export type LogWriterParams = Omit[0], "module"> & { module?: string; }; export declare class LogWriter { private readonly logger; private readonly module; private readonly logLevel; constructor(logger: Logger, module: string, logLevel: ClickHouseLogLevel); trace(params: LogWriterParams<"trace">): void; debug(params: LogWriterParams<"debug">): void; info(params: LogWriterParams<"info">): void; warn(params: LogWriterParams<"warn">): void; error(params: LogWriterParams<"error">): void; } /** * Mimics the runtime shape of a numeric TypeScript `enum`: an object with both * forward (`Name -> number`) and reverse (`number -> Name`) mappings. This * preserves backwards compatibility with the previous `enum ClickHouseLogLevel` * — both `ClickHouseLogLevel.TRACE` (returns `0`) and `ClickHouseLogLevel[0]` * (returns `'TRACE'`) continue to work — while staying compatible with the * `--erasableSyntaxOnly` TypeScript option (no TS `enum` declaration). */ export declare const ClickHouseLogLevel: { /** * A fine-grained debugging event. Might produce a lot of logs, so use with caution. */ readonly TRACE: 0; /** * A debugging event. Useful for debugging, but generally not needed in production. Includes technical values that might require redacting. */ readonly DEBUG: 1; /** * An informational event. Indicates that an event happened. */ readonly INFO: 2; /** * A warning event. Not an error, but is likely more important than an informational event. Addressing should help prevent potential issues. */ readonly WARN: 3; /** * An error event. Something went wrong. */ readonly ERROR: 4; /** * Logging is turned off. */ readonly OFF: 127; readonly 0: "TRACE"; readonly 1: "DEBUG"; readonly 2: "INFO"; readonly 3: "WARN"; readonly 4: "ERROR"; readonly 127: "OFF"; }; export type ClickHouseLogLevel = 0 | 1 | 2 | 3 | 4 | 127;