/** * Debug Utility for MCP Server * * This module provides debug logging that only outputs when DEBUG mode is enabled. * This prevents console.log from interfering with MCP STDIO communication. */ import type { DebugInfo } from "../types/index.js"; export type LogLevel = "debug" | "info" | "warn" | "error"; export interface Logger { log(...args: unknown[]): void; info(...args: unknown[]): void; warn(...args: unknown[]): void; error(...args: unknown[]): void; } export interface StructuredLogger extends Logger { logStructured(info: DebugInfo): void; child(context: Record): StructuredLogger; } /** * Debug logger that only outputs in debug mode */ export declare const debug: Logger; /** * Silent logger for production use */ export declare const silent: Logger; /** * Create a structured logger instance */ export declare const createStructuredLogger: (context?: Record) => StructuredLogger; /** * Default logger instance */ export declare const logger: Logger; /** * Create a logger with context */ export declare const createLogger: (context?: Record) => StructuredLogger; /** * Performance measurement utility */ export interface PerformanceTimer { end(): number; endWithLog(message?: string): number; } export declare const startTimer: (label?: string) => PerformanceTimer; /** * Log error with stack trace */ export declare const logError: (error: Error | string, context?: Record) => void; /** * Conditional logging */ export declare const logIf: (condition: boolean, level?: LogLevel) => Logger | ((...args: unknown[]) => void); /** * Type-safe environment variable getter with security logging */ export declare const getEnvVar: (key: string, defaultValue?: string) => string | undefined; /** * Validate required environment variables with secure error messages */ export declare const validateEnvVars: (required: string[]) => void; /** * Sanitize environment variable for logging */ export declare const sanitizeEnvValue: (key: string, value: string) => string; /** * Get sanitized environment summary for debugging */ export declare const getEnvSummary: (keys: string[]) => Record; //# sourceMappingURL=debug.d.ts.map