/** * Logger Types * * Centralized type definitions for the logging system. */ import type { Logger } from 'pino'; /** * Basic log entry structure */ export interface LogEntry { timestamp: string; level: LogLevel; message: string; module?: string; service?: string; extension?: string; requestId?: string; sessionKey?: string; sessionId?: string; userId?: string; [key: string]: unknown; } /** * Log levels in order of severity */ export declare const LogLevel: { readonly TRACE: "trace"; readonly DEBUG: "debug"; readonly INFO: "info"; readonly WARN: "warn"; readonly ERROR: "error"; readonly FATAL: "fatal"; readonly SILENT: "silent"; }; export type LogLevel = typeof LogLevel[keyof typeof LogLevel]; /** * Log level numeric values (for comparison) */ export declare const LogLevelValue: Record; /** * Common log context fields */ export interface LogContext { /** Request/operation ID for tracing */ requestId?: string; /** Session ID for user tracking */ sessionKey?: string; /** Active transcript/session instance id */ sessionId?: string; /** Cross-service trace id when distinct from requestId */ correlationId?: string; /** User ID */ userId?: string; /** Module/component name */ module?: string; /** Extension name */ extension?: string; /** Service name */ service?: string; /** Additional context */ [key: string]: unknown; } /** * Extended logger with context support */ export interface ContextualLogger extends Logger { /** * Set default context for all subsequent logs */ withContext(context: LogContext): ContextualLogger; } /** * Logger configuration options */ export interface LoggerConfig { /** Minimum log level */ level: LogLevel; /** Log directory */ logDir: string; /** Enable console output */ consoleOutput: boolean; /** Enable file output */ fileOutput: boolean; /** Enable error-only file output */ errorFileOutput: boolean; /** Log rotation: max days to keep */ retentionDays: number; /** Log rotation: max file size in MB */ maxFileSizeMB: number; /** Enable pretty print for console (dev only) */ prettyPrint: boolean; } /** * Log file metadata */ export interface LogFileMeta { name: string; path: string; size: number; created: string; modified: string; type: 'app' | 'error' | 'audit' | 'access'; lines?: number; } /** * Log query options */ export interface LogQuery { /** Filter by log levels */ levels?: LogLevel[]; /** Start timestamp (ISO 8601) */ from?: string; /** End timestamp (ISO 8601) */ to?: string; /** Keyword search */ q?: string; /** Filter by module */ module?: string; /** Filter by extension */ extension?: string; /** Filter by service */ service?: string; /** Filter by request ID */ requestId?: string; /** Filter by session ID */ sessionKey?: string; /** Filter by active transcript/session instance id */ sessionId?: string; /** Pagination offset */ offset?: number; /** Pagination limit */ limit?: number; /** Sort order: 'asc' | 'desc' */ order?: 'asc' | 'desc'; } /** * Log statistics */ export interface LogStats { byLevel: Record; } /** * Log rotation result */ export interface RotationResult { rotated: number; deleted: number; compressed: number; errors: string[]; }