✨ Features
- Caller-aware helpers:
liblaf.logging.info()and friends attribute shared helper logs to the first visible caller frame. - Rich console and file output: Handlers render compact time, level, location, highlighted messages, Rich renderables, pretty objects, and tracebacks.
- Scoped array and tensor summaries: NumPy, Torch, and JAX output is compacted while records are rendered when those libraries are already imported.
- Per-record rate limits: Add
extra={"limits": "1/minute"}or aLimitOptionsobject to suppress noisy repeat logs. - Process hooks:
init()captures warnings, uncaught exceptions, and unraisable exceptions through the standard logging pipeline;restore()releases hooks it still owns. - Optional adapters: exception and object formatting prefer
liblaf.tracebackandliblaf.pprint.pretty()when installed, without making either a dependency. - Structured progress rendering: records emitted by
liblaf.progressare rendered directly without making progress tracking a logging concern. - Release-aware defaults: Development and prerelease distributions can get louder logger defaults while stable installed modules stay at
NOTSET.
📦 Installation
uv add liblaf-logging
🚀 Quick Start
import liblaf.logging
liblaf.logging.init(force=True)
liblaf.logging.info("ready")
assert liblaf.logging.ic("ready") == "ready"
init() configures the root logger at INFO by default, installs Rich output,
registers TRACE and ICECREAM level names, captures warnings, and adds
exception hooks. When it creates handlers itself, each managed handler receives
a LimitsFilter. While a record is rendered, NumPy, Torch, and JAX print
options are scoped to compact summaries if those libraries are already loaded.
Use the module-level helpers when library or framework glue should log as the application code that called it.
import liblaf.logging
def announce() -> None:
liblaf.logging.info("starting")
Install liblaf-progress separately when progress tracking is needed. Create
and manage progress there; liblaf.logging renders the structured records it
emits:
import liblaf.progress
progress = liblaf.progress.get_progress()
task = progress.add_task("Indexing", total=10)
progress.advance(task)
🚦 Rate Limits
Attach a limits value to an individual record.
import liblaf.logging
liblaf.logging.warning("still waiting", extra={"limits": "1/minute"})
For shared buckets, custom identifiers, or non-default costs, pass
LimitOptions.
from liblaf.logging.filters import LimitOptions
liblaf.logging.warning(
"sync retry",
extra={
"limits": LimitOptions(
"5/minute",
namespace=("sync",),
identifiers=("account-42",),
cost=1,
)
},
)
⚙️ Configuration
Settings use the LOG_ environment prefix through
liblaf-conf. The most common options are
LOG_LEVEL, LOG_FILE, LOG_TIME_RELATIVE, LOG_HIDE_FRAME, and
LOG_HIDE_STABLE_RELEASE.
LOG_LEVEL=DEBUG LOG_FILE=logs/app.log python app.py
🧭 Release-Aware Defaults
SanitizedLogger checks module files against selected installed distributions
when a logger is created without an explicit level. .devN distributions use
the development level, prerelease distributions use the prerelease level, and
stable distributions keep the normal NOTSET logger default.
The classifier expands metadata only for those selected distributions. Exact
files are matched directly, and .pth files from selected distributions add
source-tree prefixes for editable-style layouts. Stable distribution metadata is
not expanded, and direct_url.json is not followed.
⌨️ Local Development
git clone https://github.com/liblaf/logging.git
cd logging
uv sync
uv run pytest
mise run docs:build
📝 License
Metadata
Release files for liblaf-logging 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| liblaf_logging-0.2.0.tar.gz | 21.0 kB | With provenance | Details for liblaf_logging-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| liblaf_logging-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for liblaf_logging-0.2.0-py3-none-any.whl |
Total release size: 52.0 kB
Release files / liblaf_logging-0.2.0.tar.gz
| Download URL | liblaf_logging-0.2.0.tar.gz |
|---|---|
| Size | 21.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e807de051a4ae9323b8059781345393c1f16820ccee74766df1e3098d9d7d340
|
|
BLAKE2b-256 checksum How to use checksums |
c22291be337693eae0ceadf34dcfbd153f8ebf2f72ead029aeeafe07bfe4b4c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logRelease files / liblaf_logging-0.2.0-py3-none-any.whl
| Download URL | liblaf_logging-0.2.0-py3-none-any.whl |
|---|---|
| Size | 31.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
114da46cdd5671e5ef84b4b68a49d06c81d3a51c1d86c32da5ddd21518a29ad5
|
|
BLAKE2b-256 checksum How to use checksums |
74ef02eae131eed47762fae36fbe479e208f495e6881ee6bfe0523bf36298bed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logSecurity for liblaf-logging 0.2.0
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for liblaf_logging-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logA 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.