-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
ImprovementIdea on how to make a feature betterIdea on how to make a feature betterenhancementNew feature or requestNew feature or request
Description
Description
Replace file-based logging with structured logging for better observability.
Current State
- File-based logging to /tmp/opik-mcp.log
- Simple text format
- Limited metadata
Target State
- Structured JSON logging
- Multiple log levels
- Rich metadata
- Log rotation
- Multiple outputs
Implementation Options
- pino (recommended - fast, low overhead)
- winston (feature-rich)
Tasks
- Choose logging library (pino recommended)
- Replace all logToFile() calls
- Configure log levels (error, warn, info, debug, trace)
- Add structured metadata to logs
- Configure log rotation
- Add multiple outputs (file, console, remote)
- Update configuration for log level control
- Update documentation
Example with Pino
import pino from 'pino';
const logger = pino({
level: config.logLevel || 'info',
transport: {
target: 'pino-pretty',
options: { colorize: true }
}
});
logger.info({ tool: 'get-prompts', duration: 123 }, 'Tool executed');
Log Levels
- error: Errors that need attention
- warn: Warnings
- info: General information
- debug: Debug information
- trace: Detailed trace information
Benefits
- Easier log parsing
- Better debugging
- Integration with log aggregators
- Performance insights
Metadata
Metadata
Assignees
Labels
ImprovementIdea on how to make a feature betterIdea on how to make a feature betterenhancementNew feature or requestNew feature or request