UNPKG

@alcyone-labs/simple-mcp-logger

Version:

Logging solution for MCP servers. Prevents console output from corrupting MCP protocol communication. Drop-in replacement for console, Winston, and Pino with automatic STDOUT suppression in MCP mode.

85 lines 2.33 kB
import { Logger, LogLevel } from '../SimpleMcpLogger.js'; /** * Pino transport that uses SimpleMcpLogger as the underlying logger */ export declare class SimpleMcpPinoTransport { private logger; private options; constructor(options?: PinoTransportOptions); /** * Map Pino log levels to SimpleMcpLogger levels */ private mapPinoLevelToMcp; /** * Transform function for Pino transport */ transform(chunk: any): void; /** * Set MCP mode */ setMcpMode(enabled: boolean): void; /** * Set log level */ setLevel(level: LogLevel): void; /** * Set prefix */ setPrefix(prefix: string): void; /** * Create child logger */ child(prefix: string): SimpleMcpPinoTransport; /** * Get the underlying SimpleMcpLogger instance */ getLogger(): Logger; /** * Set log file path */ setLogFile(filePath: string): Promise<void>; /** * Close file stream */ close(): Promise<void>; } /** * Options for Pino transport */ export interface PinoTransportOptions { level?: LogLevel; mcpMode?: boolean; prefix?: string; logToFile?: string; } /** * Factory function to create Pino transport */ export declare function createPinoTransport(options?: PinoTransportOptions): SimpleMcpPinoTransport; /** * Create a Pino destination that uses SimpleMcpLogger */ export declare function createPinoDestination(options?: PinoTransportOptions): { write(chunk: any): void; end(): Promise<void>; destroy(): Promise<void>; }; /** * Create a Pino logger that uses SimpleMcpLogger as the underlying transport * Note: This function requires Pino to be installed and available in the environment * * @deprecated This function uses dynamic imports which are not bundler-friendly. * Instead, import Pino directly in your application and use createPinoDestination: * * ```typescript * import pino from 'pino'; * import { createPinoDestination } from '@alcyone-labs/simple-mcp-logger'; * * const destination = createPinoDestination({ level: 'info' }); * const logger = pino({ level: 'info' }, destination); * ``` */ export declare function createPinoLogger(_options?: PinoTransportOptions & { name?: string; }): void; //# sourceMappingURL=pino.d.ts.map