@toolprint/hypertool-mcp
Version:
HyperTool MCP proxy server for routing requests between clients and multiple underlying MCP servers
92 lines • 2.92 kB
TypeScript
/**
* Direct Pino logging implementation with proper memory management
* Based on original implementation from hypertool-mcp commit 9340024b65482cff004a83432c254bd9d6abd939
*/
import pino from "pino";
import { RuntimeOptions } from "../../types/runtime.js";
import { LoggerInterface, LoggingConfig, LogContext } from "./interfaces.js";
export declare const DEFAULT_PINO_LOGGING_CONFIG: LoggingConfig;
/**
* PinoLogger class with proper child logger caching and transport management
*/
export declare class PinoLogger implements LoggerInterface {
private pinoLogger;
private config;
private runtimeOptions?;
private childLoggerCache;
private configHash;
constructor(config?: Partial<LoggingConfig>, runtimeOptions?: RuntimeOptions);
/**
* Calculate a hash of the configuration for caching
*/
private calculateConfigHash;
/**
* Get or create Pino instance with proper transport configuration
*/
private getOrCreatePinoInstance;
/**
* Get transport configuration with shared instances
*/
private getTransportConfig;
/**
* Create pretty transport configuration
*/
private createPrettyTransport;
/**
* Create file transport configuration
*/
private createFileTransport;
/**
* Get the log file path for the current server
*/
private getLogFilePath;
/**
* Format context for log messages with Error handling
*/
private formatContext;
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;
/**
* Create child logger with caching to prevent EventEmitter memory leaks
*/
child(bindings: {
module?: string;
[key: string]: unknown;
}): LoggerInterface;
/**
* Update configuration and reinitialize Pino instance if needed
*/
updateConfig(config: Partial<LoggingConfig>): void;
/**
* Legacy compatibility - access to underlying Pino logger
*/
get pino(): pino.Logger;
/**
* Legacy compatibility - same as pino for backward compatibility
*/
get mcp(): pino.Logger;
/**
* Get diagnostic information about child logger cache
*/
getCacheStats(): {
childLoggerCount: number;
cacheSize: number;
cacheKeys: string[];
};
/**
* Clear the global Pino instance cache (mainly for testing)
*/
static clearInstanceCache(): void;
/**
* Get diagnostic information about Pino instance cache
*/
static getInstanceCacheStats(): {
instanceCount: number;
configHashes: string[];
};
}
//# sourceMappingURL=pinoLogger.d.ts.map