← ClaudeAtlas

logslisted

Logging Setup & Analysis
AreteDriver/ai-skills · ★ 3 · AI & Automation · score 71
Install: claude install-skill AreteDriver/ai-skills
# /logs - Logging Setup & Analysis Configure logging and analyze log output. ## Usage ``` /logs # Analyze current logging setup /logs --setup # Set up logging from scratch /logs --analyze file.log # Analyze log file /logs --search "error" # Search logs for pattern ``` ## What This Skill Does 1. **Audit Logging** - Check current logging configuration 2. **Setup Logging** - Configure structured logging 3. **Analyze Logs** - Parse and summarize log files 4. **Find Issues** - Search for errors, patterns 5. **Add Context** - Request IDs, user context ## Python Logging Setup ### Basic Setup ```python # logging_config.py import logging import sys from datetime import datetime def setup_logging(level: str = "INFO", json_format: bool = False): """Configure application logging.""" if json_format: # JSON format for production import json class JsonFormatter(logging.Formatter): def format(self, record): log_data = { "timestamp": datetime.utcnow().isoformat(), "level": record.levelname, "logger": record.name, "message": record.getMessage(), "module": record.module, "function": record.funcName, "line": record.lineno, } if record.exc_info: log_data["exception"] = self.formatException(record.exc_info)