/** * Structured LSP logger for DomainLang (PRS-017 R17). * * Wraps console.warn/error with structured context (component name, * document URI, timing data) so that log messages are easy to * correlate when debugging multi-file change propagation. * * Usage: * ```ts * const log = createLogger('IndexManager'); * log.info('exports changed', { uri, count: 3 }); * log.warn('stale cache entry'); * log.error('cycle detected', { cycle: ['a', 'b', 'a'] }); * log.timed('rebuildAll', async () => { ...work... }); * ``` * * Output goes to stderr (visible in VS Code's "Output" → "DomainLang" channel) * because the LSP protocol uses stdout for JSON-RPC messages. */ /** Structured context attached to log messages. */ export interface LogContext { /** Langium document URI, shortened for readability. */ uri?: string; /** Additional key → value pairs (serialised as JSON). */ [key: string]: unknown; } export interface LspLogger { info(message: string, context?: LogContext): void; warn(message: string, context?: LogContext): void; error(message: string, context?: LogContext): void; /** * Measures and logs the duration of an async operation. * Returns the operation's result. */ timed(label: string, fn: () => T | Promise): Promise; } /** * Creates a structured logger scoped to a named component. * * @param component - Short component name (e.g. 'IndexManager', 'ImportResolver') */ export declare function createLogger(component: string): LspLogger;