@ai-capabilities-suite/mcp-debugger-core
Version:
Core debugging engine for Node.js and TypeScript applications. Provides Inspector Protocol integration, breakpoint management, variable inspection, execution control, profiling, hang detection, and source map support.
119 lines (118 loc) • 2.69 kB
TypeScript
/**
* Log levels for structured logging
*/
export declare enum LogLevel {
DEBUG = "debug",
INFO = "info",
WARN = "warn",
ERROR = "error"
}
/**
* Structured log entry
*/
export interface LogEntry {
timestamp: string;
level: LogLevel;
message: string;
correlationId?: string;
sessionId?: string;
operationType?: string;
context?: Record<string, any>;
error?: {
message: string;
stack?: string;
code?: string;
};
}
/**
* Logger configuration
*/
export interface LoggerConfig {
minLevel?: LogLevel;
enableConsole?: boolean;
enableJson?: boolean;
includeTimestamp?: boolean;
}
/**
* Structured logger for enterprise observability
* Provides JSON-formatted logging with correlation IDs and context
*/
export declare class StructuredLogger {
private config;
private logBuffer;
private readonly maxBufferSize;
constructor(config?: LoggerConfig);
/**
* Generate a correlation ID for request tracing
*/
generateCorrelationId(): string;
/**
* Check if a log level should be logged based on configuration
*/
private shouldLog;
/**
* Create a log entry
*/
private createLogEntry;
/**
* Format log entry for output
*/
private formatLogEntry;
/**
* Write log entry to output
*/
private writeLog;
/**
* Log a debug message
*/
debug(message: string, context?: {
correlationId?: string;
sessionId?: string;
operationType?: string;
additionalContext?: Record<string, any>;
}): void;
/**
* Log an info message
*/
info(message: string, context?: {
correlationId?: string;
sessionId?: string;
operationType?: string;
additionalContext?: Record<string, any>;
}): void;
/**
* Log a warning message
*/
warn(message: string, context?: {
correlationId?: string;
sessionId?: string;
operationType?: string;
additionalContext?: Record<string, any>;
}): void;
/**
* Log an error message
*/
error(message: string, context?: {
correlationId?: string;
sessionId?: string;
operationType?: string;
additionalContext?: Record<string, any>;
error?: Error;
}): void;
/**
* Get recent log entries
*/
getRecentLogs(count?: number): LogEntry[];
/**
* Clear log buffer
*/
clearLogs(): void;
/**
* Set minimum log level
*/
setMinLevel(level: LogLevel): void;
/**
* Get current configuration
*/
getConfig(): Required<LoggerConfig>;
}