UNPKG

docker-pilot

Version:

A powerful, scalable Docker CLI library for managing containerized applications of any size

145 lines 3.29 kB
/** * Logger utility for Docker Pilot * Provides structured logging with different levels and colored output */ import { LogLevel, LogEntry } from '../types'; export interface LoggerConfig { level: LogLevel; enableColors: boolean; enableTimestamp: boolean; enableSource: boolean; silent: boolean; } export declare class Logger { private config; private logs; constructor(config?: Partial<LoggerConfig>); /** * Log levels hierarchy */ private static readonly LOG_LEVELS; /** * ANSI color codes for console output */ private static readonly COLORS; /** * Icons for different log levels */ private static readonly ICONS; /** * Check if a log level should be displayed */ private shouldLog; /** * Format context data for display */ private formatContext; /** * Format log message with colors and timestamp */ private formatMessage; /** * Get color for log level */ private getLevelColor; /** * Core log method */ private log; /** * Debug level logging */ debug(message: string, context?: any, source?: string): void; /** * Info level logging */ info(message: string, context?: any, source?: string): void; /** * Warning level logging */ warn(message: string, context?: any, source?: string): void; /** * Error level logging */ error(message: string, context?: any, source?: string): void; /** * Success logging (special case of info) */ success(message: string, context?: any, source?: string): void; /** * Loading/progress logging */ loading(message: string, context?: any, source?: string): void; /** * Command execution logging */ command(command: string, source?: string): void; /** * Service status logging */ service(serviceName: string, status: string, details?: any): void; /** * Clear console */ clear(): void; /** * Print separator line */ separator(char?: string, length?: number): void; /** * Print header */ header(title: string): void; /** * Print blank line */ newLine(): void; /** * Table logging */ table(data: any[], headers?: string[]): void; /** * JSON logging */ json(data: any, label?: string): void; /** * Update logger configuration */ configure(config: Partial<LoggerConfig>): void; /** * Get all log entries */ getLogs(): LogEntry[]; /** * Get logs by level */ getLogsByLevel(level: LogLevel): LogEntry[]; /** * Clear log history */ clearLogs(): void; /** * Export logs to string */ exportLogs(): string; /** * Set log level */ setLevel(level: LogLevel): void; /** * Enable/disable colors */ setColors(enabled: boolean): void; /** * Enable/disable silent mode */ setSilent(silent: boolean): void; /** * Create child logger with context */ child(source: string): Logger; } /** * Default logger instance */ export declare const logger: Logger; //# sourceMappingURL=Logger.d.ts.map