@toolprint/hypertool-mcp
Version:
HyperTool MCP proxy server for routing requests between clients and multiple underlying MCP servers
85 lines • 3 kB
TypeScript
/**
* Enhanced logging framework with feature flag support
* Supports both Pino (default) and mcp-logger implementations
*/
import { RuntimeOptions } from "../types/runtime.js";
import { LoggerInterface, LoggingConfig, LogContext, LogLevel } from "./logger/interfaces.js";
export type { LogContext, LogLevel, LoggingConfig };
export declare const DEFAULT_LOGGING_CONFIG: LoggingConfig;
/**
* Create logging configuration based on runtime options and environment
*/
export declare function createLoggingConfig(runtimeOptions?: RuntimeOptions): LoggingConfig;
/**
* Logger class that wraps the feature-flag-selected implementation
* Maintains backward compatibility with existing API
*/
export declare class Logger implements LoggerInterface {
private implementation;
private childLoggerCache;
constructor(config?: Partial<LoggingConfig>, runtimeOptions?: RuntimeOptions);
fatal(message: string, context?: LogContext): void;
error(message: string, context?: LogContext): void;
warn(message: string, context?: LogContext): void;
info(message: string, context?: LogContext): void;
debug(message: string, context?: LogContext): void;
trace(message: string, context?: LogContext): void;
child(bindings: {
module?: string;
[key: string]: unknown;
}): Logger;
updateConfig(config: Partial<LoggingConfig>): void;
get pino(): any;
get mcp(): any;
/**
* Get cache statistics for diagnostics
*/
getCacheStats(): {
childLoggerCount: number;
cacheSize: number;
cacheKeys: string[];
};
}
/**
* Get or create the global logger instance
*/
export declare function getLogger(config?: Partial<LoggingConfig>, runtimeOptions?: RuntimeOptions): Logger;
/**
* Async version of getLogger that properly initializes feature flags
*/
export declare function getLoggerAsync(config?: Partial<LoggingConfig>, runtimeOptions?: RuntimeOptions): Promise<Logger>;
/**
* Get the currently active logging configuration
*/
export declare function getActiveLoggingConfig(): Partial<LoggingConfig> | null;
/**
* Create a child logger with module context
* This maintains backward compatibility with the existing API
*/
export declare function createChildLogger(bindings: {
module: string;
}): Logger;
/**
* Async version of createChildLogger that properly initializes feature flags
*/
export declare function createChildLoggerAsync(bindings: {
module: string;
}): Promise<Logger>;
/**
* Get diagnostic information about the logging system
* Useful for debugging EventEmitter memory leaks
*/
export declare function getLoggerDiagnostics(): {
hasGlobalLogger: boolean;
implementationType: string;
cacheStats?: any;
};
/**
* Reset global logger state (mainly for testing)
*/
export declare function resetGlobalLogger(): void;
/**
* Force feature flag for testing
*/
export declare function forceSetMcpLoggerEnabled(enabled: boolean): void;
//# sourceMappingURL=logging.d.ts.map