/** * NDJSON File Logger * * Writes structured logs to .smartergpt/lex/logs/lex.log.ndjson * with stable field names for parsing and analysis. * * Log format: * { * "timestamp": "2025-11-09T12:34:56.789Z", * "level": "info", * "module": "memory/store", * "operation": "saveFrame", * "duration_ms": 12, * "message": "Frame saved successfully", * "metadata": { "frameId": "abc123", "jira": "PROJ-123" }, * "error": { "name": "Error", "message": "...", "stack": "..." } * } */ export type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal"; export interface LogEntry { timestamp: string; level: LogLevel; message?: string; module?: string; operation?: string; duration_ms?: number; error?: { name: string; message: string; stack?: string; }; metadata?: Record; } /** * Get the log directory path */ export declare function getLogDirectory(): string; /** * Get the current log file path */ export declare function getLogFilePath(): string; /** * Rotate log file if it exceeds max size (default 100MB) */ export declare function rotateLogIfNeeded(maxSizeBytes?: number): void; /** * Write a log entry to the NDJSON log file */ export declare function writeLog(entry: LogEntry): void; /** * Create a scoped NDJSON logger */ export declare class NDJSONLogger { private module; constructor(module: string); private log; trace(message: string, opts?: Parameters[2]): void; debug(message: string, opts?: Parameters[2]): void; info(message: string, opts?: Parameters[2]): void; warn(message: string, opts?: Parameters[2]): void; error(message: string, opts?: Parameters[2]): void; fatal(message: string, opts?: Parameters[2]): void; } /** * Get a scoped NDJSON logger instance */ export declare function getNDJSONLogger(module: string): NDJSONLogger;