UNPKG

@agentman/chat-widget

Version:

Agentman Chat Widget for easy integration with web applications

66 lines (65 loc) 1.69 kB
import type { DebugConfig } from '../types/types'; export type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'verbose'; /** * Logger class for controlled debug output * Provides different log levels and can be configured per instance */ export declare class Logger { private enabled; private logLevel; private timestamps; private useConsole; private customLogger?; private prefix; private readonly levels; constructor(config?: boolean | DebugConfig, prefix?: string); /** * Check if a log level should be output */ private shouldLog; /** * Format the log message with optional timestamp */ private formatMessage; /** * Output the log message */ private output; /** * Log error messages (always logged unless disabled) */ error(message: string, error?: Error | any): void; /** * Log warning messages */ warn(message: string, data?: any): void; /** * Log info messages */ info(message: string, data?: any): void; /** * Log debug messages (for development) */ debug(message: string, data?: any): void; /** * Log verbose messages (detailed debugging) */ verbose(message: string, data?: any): void; /** * Create a child logger with a specific prefix */ child(prefix: string): Logger; /** * Update logger configuration at runtime */ setConfig(config: DebugConfig): void; /** * Enable/disable logger */ setEnabled(enabled: boolean): void; /** * Set log level */ setLogLevel(level: LogLevel): void; } export declare const defaultLogger: Logger;