codecrucible-synth
Version:
Production-Ready AI Development Platform with Multi-Voice Synthesis, Smithery MCP Integration, Enterprise Security, and Zero-Timeout Reliability
157 lines • 3.96 kB
TypeScript
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
export interface LogEntry {
timestamp: Date;
level: LogLevel;
message: string;
data?: any;
error?: Error;
traceId?: string;
spanId?: string;
correlationId?: string;
userId?: string;
sessionId?: string;
}
export interface LoggerConfig {
level: LogLevel;
toFile: boolean;
toConsole: boolean;
maxFileSize: string;
maxFiles: number;
logDirectory?: string;
}
/**
* Enterprise Logger with Winston - 2025 Best Practices
*
* Features:
* - Structured JSON logging for observability
* - High-performance async operations
* - OpenTelemetry integration
* - Production-grade error handling
* - Multiple transport support
*/
declare class Logger {
private config;
private winstonLogger;
private logDirectory;
private name?;
constructor(nameOrConfig?: string | Partial<LoggerConfig>, config?: Partial<LoggerConfig>);
/**
* Setup Winston logger with structured JSON format - 2025 Best Practice
*/
private setupWinstonLogger;
/**
* Parse file size string to bytes
*/
private parseFileSize;
/**
* Ensure log directory exists
*/
private ensureLogDirectory;
/**
* Get numeric level for comparison
*/
private getNumericLevel;
/**
* Check if message should be logged based on level
*/
private shouldLog;
/**
* Format timestamp for display
*/
private formatTimestamp;
/**
* Get colored prefix for console output
*/
private getColoredPrefix;
/**
* Format message for console output
*/
private formatConsoleMessage;
/**
* Format message for file output
*/
private formatFileMessage;
/**
* Log a message with specified level - 2025 Winston Implementation
*/
private log;
/**
* Debug level logging
*/
debug(message: string, data?: any): void;
/**
* Info level logging
*/
info(message: string, data?: any): void;
/**
* Warning level logging
*/
warn(message: string, data?: any): void;
/**
* Error level logging
*/
error(message: string, error?: Error | any, data?: any): void;
/**
* Update logger configuration
*/
updateConfig(config: Partial<LoggerConfig>): void;
/**
* Get current configuration
*/
getConfig(): LoggerConfig;
/**
* Flush pending logs (Winston handles automatically)
*/
flush(): Promise<void>;
/**
* Create a child logger with additional context
*/
child(context: string): Logger;
/**
* Performance timing utility
*/
time(label: string): () => void;
/**
* Log performance of async operations
*/
profile<T>(label: string, operation: () => Promise<T>): Promise<T>;
/**
* Log system information
*/
logSystemInfo(): void;
/**
* Audit log for compliance and security
*/
audit(action: string, details: {
userId?: string;
sessionId?: string;
ip?: string;
userAgent?: string;
resource?: string;
status?: 'success' | 'failure';
[key: string]: any;
}): void;
/**
* Security event logging
*/
security(event: string, details: {
severity: 'low' | 'medium' | 'high' | 'critical';
threatType?: string;
userId?: string;
ip?: string;
mitigated?: boolean;
[key: string]: any;
}): void;
/**
* Performance metrics logging
*/
metric(name: string, value: number, unit?: string, tags?: Record<string, string>): void;
/**
* Business event logging
*/
business(event: string, details: Record<string, any>): void;
}
export declare const logger: Logger;
export { Logger };
export declare function configureLogger(config: Partial<LoggerConfig>): void;
//# sourceMappingURL=logger.d.ts.map