Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

python-loguru-logging

/python-loguru-logging

Konfiguruje i przegląda logowanie w Loguru: przechwytywanie wyjątków, kontekst, rotację, kompresję i zamykanie procesu.

Licencja
MIT
Ostatnia zmiana repozytorium
12.11.2026

Ocena i bezpieczeństwo

90/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
3
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 12.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Konfiguruje i przegląda logowanie w Loguru: przechwytywanie wyjątków, kontekst, rotację, kompresję i zamykanie procesu.

Oryginalny opis (EN)

Configures and reviews Loguru exception capture, bound context, file sinks, rotation, retention, compression, queued logging, and shutdown completion. Use when project failure and deployment requirements justify those features. Do not use for standard-library logging, observability vendors, or incidental logger calls.

Jak działa

  1. Activation
  2. Review Exception Boundaries
  3. Bind Stable Context
  4. Configure File Lifecycle Deliberately
  5. Complete and Shut Down
  6. Required Output
Sekcje z nagłówków SKILL.md, w oryginale · 60 linii, 466 słów
Podgląd SKILL.md
---
name: python-loguru-logging
description: Configures and reviews Loguru exception capture, bound context, file sinks, rotation, retention, compression, queued logging, and shutdown completion. Use when project failure and deployment requirements justify those features. Do not use for standard-library logging, observability vendors, or incidental logger calls.
metadata:
  short-description: Configure Loguru exceptions, context, sinks, and shutdown
---

# Python Loguru Logging

## Activation

- **Keyword trigger:** the task substantively involves Loguru, `logger.catch`, `logger.bind`, `logger.contextualize`, `logger.add`, `rotation`, `retention`, `compression`, `enqueue`, or `logger.complete`.
- **Intent trigger:** the user asks to improve Loguru exception boundaries, structured context, file lifecycle, multiprocessing delivery, or shutdown behavior.
- **Disclosure:** once when starting applicable work, briefly state: `Using $python-loguru-logging because this task involves Loguru configuration.`
- **Exit:** stop applying this skill after exception, context, sink ownership, and shutdown decisions are complete.
- **Do not trigger:** a generic logging request using the standard library or a logger name appearing only in unrelated code is insufficient.

---

## Review Exception Boundaries

- Consider `@logger.catch` at process, worker, command, callback, or task boundaries where one place should log an otherwise uncaught exception.
- Do not decorate every custom function. Broad catch/log layers can duplicate traces, obscure ownership, or suppress errors.
- Check `reraise`: the default can prevent propagation. Use `reraise=True` when callers, supervisors, tests, or retry logic must still observe failure.
- Prefer ordinary `try`/`except` when recovery, translation, cleanup, or different handling by exception type is required.
- In production, review `diagnose=False` where exception diagnostics could expose local values or secrets.

---

## Bind Stable Context

- Use `logger.bind(...)` for stable context attached to a component or operation, such as job, tenant, request, or object identity.
- Use `logger.contextualize(...)` for scoped context that should follow the current thread or async task.
- Include bound fields in sink formats or serialized records; binding unused fields adds complexity without improving logs.
- Do not bind secrets, tokens, full payloads, or unbounded high-cardinality objects.

---

## Configure File Lifecycle Deliberately

For file sinks, decide from deployment requirements whether to use:

- `rotation="... MB"` for a size limit or another supported time/size policy;
- `retention="... days"` to remove old matching files;
- `compression="zip"` to archive rotated/closed files; and
- `enqueue=True` for non-blocking calls and a multiprocessing-safe queue when concurrency requires it.

The option is spelled `retention`. Do not add rotation, retention, compression, or queuing mechanically: container stdout collection, external log rotation, disk limits, multi-process topology, and shutdown ownership may call for a different design. Avoid configuring the same file sink independently in multiple spawned processes.

Read [references/loguru-guide.md](references/loguru-guide.md) for shutdown and verification details.

---

## Complete and Shut Down

- Call `logger.complete()` when the application owns handlers with `enqueue=True` and must flush queued messages before process exit, especially around multiprocessing boundaries.
- For coroutine sinks, `await logger.complete()` before the owning event loop closes.
- Keep handler IDs when explicit removal and lifecycle management are required.
- Treat logging failure policy separately from application exception policy; sink `catch` and `logger.catch` solve different problems.

---

## Required Output

State the exception boundary and propagation behavior, bound/contextual fields, sink ownership, rotation/retention/compression rationale, queue and multiprocessing behavior, sensitive-data controls, and shutdown/`complete()` path.
Pliki w paczce (3)
  • SKILL.md 4 KB
  • agents/openai.yaml 1 KB
  • references/loguru-guide.md 2 KB

Wersje

W bazie nie ma innych skilli o nazwie python-loguru-logging.

Migawka bazy z 13.11.2026 · wersja paczki 83d1a1915887 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 85backend-error-observability-review
    Przegląda obsługę błędów, wyjątki, logowanie, metryki i śledzenie w kodzie backendu pod kątem jakości obserwowalności.
  • 100logging
    Pomaga używać wellcrafted/logger, ujść logów, diagnostyki bibliotek, typowanego logowania, błędów w tle i trwałych logów hosta oraz zastępować console.* w kodzie bibliotek.
  • 95logging
    Wdraża logowanie strukturalne z poziomami logów i bezpieczną obsługą danych wrażliwych, by zwiększyć obserwowalność aplikacji.
  • 95python-logging
    Obsługuje logowanie w Pythonie z modułem logging i structlog: poziomy logów, handlery, formattery, logi strukturalne i praktyki produkcyjne dla aplikacji FastAPI i Django.
  • 100b2c-logging
    Wdraża logowanie po stronie serwera przez dw.system.Logger z własnymi kategoriami logów, nazwanymi plikami i nested diagnostic context w kontrolerach, hookach i jobach.
  • 100logging-setup
    Generuje ustrukturyzowaną infrastrukturę logowania z os.log i Logger, która zastępuje instrukcje print(), przy konfiguracji logowania w aplikacji Apple.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.