Add monitoring, metrics tracking, and enhanced logging

- Add BotMonitor class for tracking requests, errors, and health status
- Track request success/failure, response times, error rates
- Add !status command (admin) for detailed metrics with embed
- Add !health command (anyone) for quick health check
- Add rotating file logging support (LOG_FILE config)
- Auto-detect unhealthy status when errors exceed threshold
- Record errors with timestamps and context for debugging
This commit is contained in:
2026-01-11 21:04:49 +01:00
parent 7e26adc7a7
commit 853e7c9fcd
7 changed files with 487 additions and 3 deletions

View File

@@ -62,7 +62,19 @@ SEARXNG_ENABLED=true
SEARXNG_MAX_RESULTS=5
# ===========================================
# Logging
# Logging & Monitoring
# ===========================================
# Log level: DEBUG, INFO, WARNING, ERROR
LOG_LEVEL=INFO
# Log file path (optional - logs to console only if not set)
# LOG_FILE=logs/bot.log
# Custom log format (optional)
# LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s
# ===========================================
# Monitoring Commands
# ===========================================
# Use !status (admin only) for detailed metrics
# Use !health (anyone) for quick health check