UNPKG

@sailboat-computer/event-bus

Version:

Standardized event bus for sailboat computer v3 with resilience features and offline capabilities

97 lines 2.14 kB
/** * Simple logger for the event bus */ /** * Log levels */ export declare enum LogLevel { DEBUG = "debug", INFO = "info", WARN = "warn", ERROR = "error" } /** * Logger configuration */ export interface LoggerConfig { /** * Minimum log level to output */ level: LogLevel; /** * Service name to include in logs */ serviceName: string; /** * Whether to include timestamps in logs */ includeTimestamps: boolean; } /** * Simple logger for the event bus */ export declare class Logger { private config; /** * Create a new logger * * @param config - Logger configuration */ constructor(config?: Partial<LoggerConfig>); /** * Log a debug message * * @param message - Message to log * @param data - Additional data to log */ debug(message: string, data?: any): void; /** * Log an info message * * @param message - Message to log * @param data - Additional data to log */ info(message: string, data?: any): void; /** * Log a warning message * * @param message - Message to log * @param data - Additional data to log */ warn(message: string, data?: any): void; /** * Log an error message * * @param message - Message to log * @param error - Error to log * @param data - Additional data to log */ error(message: string, error?: Error, data?: any): void; /** * Log a message * * @param level - Log level * @param message - Message to log * @param data - Additional data to log */ private log; /** * Check if a log level should be logged * * @param level - Log level to check * @returns Whether the log level should be logged */ private shouldLog; } /** * Create a new logger * * @param config - Logger configuration * @returns Logger instance */ export declare function createLogger(config?: Partial<LoggerConfig>): Logger; /** * Default logger instance */ export declare const logger: Logger; //# sourceMappingURL=logger.d.ts.map