/** * Main Logger Class for PromptSpeak MCP Server * * Provides a structured, configurable logging interface with support for: * - Multiple log levels (debug, info, warn, error, critical) * - Structured data logging * - Error serialization * - Correlation ID tracking * - Child loggers with module prefixes * - Environment-based configuration */ import { LogContext, LoggerConfig } from './types.js'; /** * Configure the global logger settings */ export declare function configureLogger(config: Partial): void; /** * Get the current logger configuration */ export declare function getLoggerConfig(): LoggerConfig; /** * Main Logger class providing structured logging capabilities. */ export declare class Logger { private module; private additionalContext; /** * Creates a new Logger instance. * * @param module - Module name to prefix log entries with (e.g., 'IntentManager') */ constructor(module: string); /** * Log a debug message. Used for detailed debugging information. */ debug(message: string, data?: Record): void; /** * Log an info message. Used for general informational messages. */ info(message: string, data?: Record): void; /** * Log a warning message. Used for potentially problematic situations. */ warn(message: string, data?: Record, error?: Error): void; /** * Log an error message. Used for error conditions. */ error(message: string, error?: Error, data?: Record): void; /** * Log a critical message. Used for severe errors requiring immediate attention. */ critical(message: string, error?: Error, data?: Record): void; /** * Create a child logger with an extended module path. * * @param subModule - Sub-module name to append to the current module * @returns A new Logger instance with the combined module path * * @example * const logger = createLogger('IntentManager'); * const childLogger = logger.child('Parser'); * // childLogger's module will be 'IntentManager:Parser' */ child(subModule: string): Logger; /** * Create a new logger with additional context that will be included in all log entries. * * @param context - Additional context to include in log entries * @returns A new Logger instance with the additional context * * @example * const logger = createLogger('API').withContext({ traceId: 'abc123' }); */ withContext(context: Partial): Logger; /** * Time an operation and log its duration. * * @param operationName - Name of the operation being timed * @param fn - Function to execute and time * @returns The result of the function * * @example * const result = await logger.time('fetchData', async () => { * return await fetch('/api/data'); * }); */ time(operationName: string, fn: () => T | Promise): Promise; /** * Core logging method that constructs and outputs log entries. */ private log; /** * Serialize an Error object for logging. */ private serializeError; /** * Write the formatted log entry to the appropriate output stream. * NOTE: MCP servers must use stderr for ALL logging since stdout is * reserved for JSON-RPC protocol communication. */ private write; } /** * Factory function to create a new Logger instance. * * @param module - Module name for the logger * @returns A new Logger instance * * @example * import { createLogger } from './core/logging'; * * const logger = createLogger('IntentManager'); * logger.info('Processing intent', { intentType: 'query' }); */ export declare function createLogger(module: string): Logger; /** * Default application logger for use when a specific module isn't relevant. */ export declare const rootLogger: Logger; //# sourceMappingURL=logger.d.ts.map