| 64 | * Prefixes all messages with the component name. |
| 65 | */ |
| 66 | export class DebugLogger { |
| 67 | private component: string |
| 68 | |
| 69 | constructor(component: string) { |
| 70 | this.component = component |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Log a debug message with optional data |
| 75 | */ |
| 76 | debug(message: string, data?: unknown): void { |
| 77 | debugLog(`[${this.component}] ${message}`, data) |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Alias for debug |
| 82 | */ |
| 83 | info(message: string, data?: unknown): void { |
| 84 | this.debug(message, data) |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Log a warning |
| 89 | */ |
| 90 | warn(message: string, data?: unknown): void { |
| 91 | debugLog(`[${this.component}] WARN: ${message}`, data) |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Log an error |
| 96 | */ |
| 97 | error(message: string, data?: unknown): void { |
| 98 | debugLog(`[${this.component}] ERROR: ${message}`, data) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Pre-configured logger for provider/mode debugging |
nothing calls this directly
no outgoing calls
no test coverage detected