Python Logging Best Practices
Python logging guide covering loguru, structlog, orjson, and a zero-dependency JSONL telemetry pattern with rotation.
- CCM score
- 55 of 100
- skills.sh installs
- 411
- GitHub stars
- 5
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers choosing a logging approach by scale: zero-dep JSONL, loguru, structlog with OpenTelemetry, stdlib, and Logfire
- Includes a complete zero-dependency telemetry logger with size-based rotation via
telemetry.jsonland journald-capturedprintoutput - Enforces a token fingerprinting rule so secrets never enter the logging pipeline, instead of relying on regex redaction
- Designed for single-server services and containerized apps that need structured, machine-readable logs for analysis
Install
$ npx -y skills add terrylica/cc-skills --skill python-logging-best-practices -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Python Logging Best Practices
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
When to Use This Skill
Use this skill when:
- Setting up Python logging for any service or script
- Configuring structured JSONL logging for analysis
- Implementing log rotation
- Choosing between lightweight (zero-dep) and full-featured logging
- Adding logging to containerized, systemd, or local applications
Overview
Unified reference for Python logging patterns optimized for machine readability (Claude Code analysis) and operational reliability. Starts with the lightest viable approach and scales up only when needed.
Decision Heuristic: Start Light, Scale Up
Is it < 5 services on a single machine, < 1 event/sec?
YES → Lightweight Pattern (print + JSONL telemetry)
NO → Is it containerized / serverless?
YES → stdout JSON (any library), no file rotation
NO → Is OTel tracing required?
YES → structlog + OTel
NO → loguru (CLI tools) or stdlib RotatingFileHandler
Details
- Repository
- github.com/terrylica/cc-skills
- Categories
- Python, DevOps & Cloud, Debugging
- First seen
- Jun 3, 2026
Questions
How do I install the python-logging-best-practices skill?
Run npx -y skills add terrylica/cc-skills --skill python-logging-best-practices -y in your project. The skill then lets your agent set up Python logging with loguru, structlog and orjson, following its trigger terms.
Where does python-logging-best-practices rank in its category?
It sits in the Python category on Claude Marketplaces and ranks in the top 100 there. Other skills in that category include python-performance-optimization, python-design-patterns and async-python-patterns.
When should I use python-logging-best-practices?
Use it when setting up Python logging for a service or script, configuring structured JSONL logging, or implementing log rotation. It also helps choose between a lightweight zero-dependency approach and a full-featured library like loguru or structlog.
Does python-logging-best-practices avoid logging secrets?
Yes, its lightweight pattern logs a non-reversible token fingerprint instead of the full token. The skill argues this keeps secrets out of the logging pipeline entirely rather than relying on regex redaction.
More from terrylica/cc-skills
All 3Similar to Python Logging Best Practices
More Pythonpython-observabilitywshobson/agents12.5K installsStructured logging, metrics, and tracing patterns for Python services with correlation IDs and log-level guidance.
logging-best-practicesmindrally/skills850 installsStructured logging guidance covering log levels, standard fields, context propagation, redaction, and aggregation practices.
application-loggingaj-geddes/useful-ai-prompts504 installsStructured logging guide for Node.js, Python, Express, Flask, and ELK pipelines with clear do and don't rules.
observability-guidelinesmindrally/skills832 installsGuidelines for observability in distributed systems covering OpenTelemetry tracing, metrics, and structured logs.