/** * Centralized logging module with dependency injection. * * By default uses a simple console-based logger (zero dependencies). * Consumers can inject a custom logger (e.g. pino) via setLogger(). * * Usage: * import { logger } from './utils/logger.js'; * logger.info('Processing file', { file: 'test.java' }); * logger.error('Failed to parse', { error: err.message }); * * Injecting a custom logger (e.g. pino): * import pino from 'pino'; * import { setLogger } from 'circle-ir'; * setLogger(pino({ level: 'debug' })); * * Log Levels (in order of severity): * - trace: Very detailed debugging * - debug: Debugging information * - info: General information * - warn: Warnings * - error: Errors * - fatal: Fatal errors * - silent: No logging (default in 3.89.1+ — keeps stdout clean for * consumers piping JSON/SARIF output; opt in via setLogLevel() or, * in the CLI, the `--log-level` flag / `COGNIUM_LOG_LEVEL` env var) * * IMPORTANT (3.89.1+): All log calls write to **stderr** (via * `console.error` / `console.warn` / `console.debug`). They never touch * stdout. This is required so CLI consumers can pipe `--format json` or * `--format sarif` output to downstream tooling without corruption. */ export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'silent'; export interface LoggerConfig { level?: LogLevel; name?: string; } /** * Interface for injectable loggers. * Compatible with pino, console, and custom implementations. */ export interface LoggerInstance { trace(msg: string, obj?: Record): void; debug(msg: string, obj?: Record): void; info(msg: string, obj?: Record): void; warn(msg: string, obj?: Record): void; error(msg: string, obj?: Record): void; fatal(msg: string, obj?: Record): void; } /** * Configure the logger. Should be called early in application startup. */ export declare function configureLogger(config: Partial): void; /** * Inject a custom logger implementation (e.g. pino). * The custom logger receives all log calls regardless of level filtering — * it is expected to handle its own level filtering. */ export declare function setLogger(instance: LoggerInstance): void; /** * Set the log level dynamically */ export declare function setLogLevel(level: LogLevel): void; /** * Get the current log level */ export declare function getLogLevel(): LogLevel; /** * The main logger instance. * Use this for all logging throughout the application. */ export declare const logger: { trace: (msg: string, obj?: Record) => void; debug: (msg: string, obj?: Record) => void; info: (msg: string, obj?: Record) => void; warn: (msg: string, obj?: Record) => void; error: (msg: string, obj?: Record) => void; fatal: (msg: string, obj?: Record) => void; isLevelEnabled: (level: LogLevel) => boolean; }; //# sourceMappingURL=logger.d.ts.map