Description:
Enhance MelleaLogger with additional logging handlers for flexible log routing to multiple destinations: stdout (console), file, OTLP logs endpoint, and HTTP webhooks.
Detailed Requirements:
- Add new handlers to MelleaLogger in
mellea/core/utils.py:
RotatingFileHandler - File output with rotation (use stdlib logging.handlers)
OTLPLogHandler - OpenTelemetry Logs Protocol exporter (custom handler)
- Keep existing
RESTHandler for webhook support
- Create handler configuration function:
configure_logging() - Set up handlers based on environment
- Called automatically on first
get_logger() call
- Configuration via environment variables:
MELLEA_LOG_CONSOLE=true/false (default: true)
MELLEA_LOG_FILE=/path/to/logs/mellea.log
MELLEA_LOG_FILE_MAX_BYTES=10485760 (default: 10MB)
MELLEA_LOG_FILE_BACKUP_COUNT=5 (default: 5)
MELLEA_LOG_OTLP=true/false
MELLEA_LOG_WEBHOOK=http://endpoint (replaces FLOG env var)
- Support JSON and human-readable formats per handler
- Ensure all handlers receive trace context and Mellea context via filters
Files to Modify:
mellea/core/utils.py - Add handlers and configuration function
Acceptance Criteria:
Description:
Enhance MelleaLogger with additional logging handlers for flexible log routing to multiple destinations: stdout (console), file, OTLP logs endpoint, and HTTP webhooks.
Detailed Requirements:
mellea/core/utils.py:RotatingFileHandler- File output with rotation (use stdliblogging.handlers)OTLPLogHandler- OpenTelemetry Logs Protocol exporter (custom handler)RESTHandlerfor webhook supportconfigure_logging()- Set up handlers based on environmentget_logger()callMELLEA_LOG_CONSOLE=true/false(default: true)MELLEA_LOG_FILE=/path/to/logs/mellea.logMELLEA_LOG_FILE_MAX_BYTES=10485760(default: 10MB)MELLEA_LOG_FILE_BACKUP_COUNT=5(default: 5)MELLEA_LOG_OTLP=true/falseMELLEA_LOG_WEBHOOK=http://endpoint(replaces FLOG env var)Files to Modify:
mellea/core/utils.py- Add handlers and configuration functionAcceptance Criteria: