# Python Logging

> Use when choosing or configuring Python logging, especially deciding between stdlib logging and loguru for apps or CLIs.

- Skill: `tomevault-io/python-logging` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/python-logging`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/python-logging/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/python-logging

---


# Python Logging

## Overview

Choose the logging system based on project needs. Core principle: stdlib logging for libraries and ecosystem integration, loguru for fast, simple app/CLI logging.

## Quick Reference

| Need | Use |
| --- | --- |
| Library or long-lived service | stdlib `logging` |
| Simple app or CLI | `loguru` |
| Integrations (Sentry/OTel) | stdlib `logging` |

## Decision Rules

Use stdlib `logging` when:
- Building a reusable library
- You need handler hierarchies or integration with ops tooling

Use `loguru` when:
- You want minimal setup and readable output
- You are building a small app or CLI

## Example

Stdlib logger setup:
```python
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.info("App started")
```

## Common Mistakes

- Forcing loguru in a reusable library.
- Mixing two logging systems without a clear boundary.

## Red Flags

- Logging recommendations with no rationale for library vs app use.

## References

- `references/logging.md` - stdlib logging patterns
- `references/loguru.md` - loguru patterns

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/narumiruna) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-13 -->

