Skip to main content

birling

birling measures log coverage in Python projects: how well the code is covered by log calls, the way coverage.py measures how well it is covered by tests. It recognises the standard logging module, structlog and loguru, and a project's own logging helpers.

A handled exception that leaves no log is a failure nobody hears about. birling finds the places in the code where something should be logged, checks whether a log call is there, and gives the project a score that a CI run can hold to a minimum. By default, those places are except handlers that do not raise again.

$ birling shop
Name              Branches  Logged  Score  Unlogged
---------------------------------------------------
shop/orders.py           2       1    50%  12
shop/payments.py         2       1    50%  12
---------------------------------------------------
TOTAL                    4       2    50%

Installation

birling needs Python 3.11 or later and has no dependencies of its own. Install it from PyPI:

pip install birling

To mark the unlogged branches that ran in the tests, and to find the logged branches where no log call ran, the command reads coverage.py's data, which needs coverage.py where birling runs. It is usually there already where the tests run; the coverage extra, birling[coverage], installs it otherwise.

Usage

birling PATH... [--config FILE] [--fail-under SCORE] [--coverage-file FILE] [--show-unlogged] [--show-unrun-logs]

The command reads its configuration from the [tool.birling] table of pyproject.toml, and exits with status 1 when the score is below the minimum:

[tool.birling]
fail-under = 80

The standard logging module needs no configuration; other logging libraries and a project's own logging helpers are described in the table.

--show-unlogged lists each unlogged branch as path:line, and a # noqa: BRL001 comment on its except line accepts a branch that rightly does not log.

Documentation

The documentation is at birling.readthedocs.io: the command, the configuration, how branches and log calls are found, and the Python interface.

The name

Log rolling, sometimes called birling, is a sparring sport involving two competitors, each standing on one end of a free-floating log in a body of water. The two battle to dislodge each other from the log while keeping their own footing on it by spinning and kicking it and various other means.

— Wikipedia, Logrolling (sport)

The lumberjacks' sport lends its name to a tool for keeping on top of a project's logs.

Status

birling is in alpha: its interface may change from one release to the next.

Metadata

Release files for birling 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for birling 0.2.1
File Size Uploaded Provenance Actions
birling-0.2.1.tar.gz 130.4 kB Without provenance Details for birling-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for birling 0.2.1
File Interpreter ABI Platform Actions
birling-0.2.1-py3-none-any.whl Python 3 none any Details for birling-0.2.1-py3-none-any.whl

Total release size: 156.7 kB

Release files / birling-0.2.1.tar.gz

Download URL birling-0.2.1.tar.gz
Size 130.4 kB
Tags Source
SHA-256 checksum
How to use checksums
363bde180a3076cfa9a96420cfc2ec8f807e5c2c0e98aeee56577db8e8b9ca83
BLAKE2b-256 checksum
How to use checksums
34ce6181db584fb4c3cdc36ade7f6ec7bfda9f6dea8ca8d13bd844807bb18192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / birling-0.2.1-py3-none-any.whl

Download URL birling-0.2.1-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7baf876b369d5f72d6587d62d9bf92ad547527330c46bb57686182a5f13ea9b
BLAKE2b-256 checksum
How to use checksums
447e4a98cc4766c1a0a5eabbd2eb974cdadcd22c2123745a0f1501b8d21276fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for birling 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page