UNPKG

bc-webclient-mcp

Version:

Model Context Protocol (MCP) server for Microsoft Dynamics 365 Business Central via WebUI protocol. Enables AI assistants to interact with BC through the web client protocol, supporting Card, List, and Document pages with full line item support and server

84 lines 2.42 kB
/** * Debug Logger Service * * Provides channel-specific debug logging with automatic rotation. * Only active when DEBUG_MODE=true in .env * * Features: * - Channel-based file separation (tools.log, websocket.log, etc.) * - Automatic log rotation (size-based) * - Timestamped entries with correlation IDs * - Performance metrics (durations, sizes) * - Structured JSON output (NDJSON format) */ import { type DebugChannel } from '../core/config.js'; /** * Debug log entry structure */ export interface DebugLogEntry { timestamp: string; channel: DebugChannel; level: 'debug' | 'trace'; message: string; correlationId?: string; data?: unknown; duration?: number; size?: number; } /** * Debug logger singleton */ declare class DebugLogger { private static instance; private logStreams; private logSizes; private initialized; private constructor(); /** * Get singleton instance */ static getInstance(): DebugLogger; /** * Initialize debug logger (create log files) */ initialize(): Promise<void>; /** * Write session header to log file */ private writeHeader; /** * Log a debug entry to the appropriate channel */ log(entry: DebugLogEntry): Promise<void>; /** * Rotate log file when it exceeds max size */ private rotateLog; /** * Shutdown debug logger (close all files) */ shutdown(): Promise<void>; } export declare const debugLogger: DebugLogger; /** * Log to tools channel (tool execution lifecycle) */ export declare const debugTools: (message: string, data?: unknown, correlationId?: string, duration?: number) => void; /** * Log to websocket channel (BC WebSocket protocol) */ export declare const debugWebSocket: (message: string, data?: unknown, correlationId?: string, size?: number) => void; /** * Log to handlers channel (handler event emission & accumulation) */ export declare const debugHandlers: (message: string, data?: unknown, correlationId?: string) => void; /** * Log to session channel (session management) */ export declare const debugSession: (message: string, data?: unknown, correlationId?: string) => void; /** * Log to cache channel (cache operations) */ export declare const debugCache: (message: string, data?: unknown, correlationId?: string) => void; export {}; //# sourceMappingURL=debug-logger.d.ts.map