kloggy
Logging helper: nice zero-config output for libraries, without fighting the app's logging setup. It started as a shared helper for HPI, promnesia, orger, cachew and data exporters like rexport, but nothing in it is specific to them.
It's developed requirements-first: see requirements, linked to the tests validating them. Work in progress, only the requirements listed there are implemented so far.
Library code gets plain stdlib loggers:
from kloggy import get_logger
logger = get_logger(__name__)
- if logging isn't configured, records are never printed as bare messages (Z1), and INFO is shown, e.g. for progress (L2)
- if the app configures logging later (e.g.
basicConfig()inmain()), kloggy steps aside for good: no duplicates (Z2), and the app's levels apply (L3) - a stray
logging.warning(...)(which implicitly callsbasicConfig()) doesn't switch kloggy off (Z3) - if the app already configured logging, kloggy doesn't touch it (L1)
Using kloggy in a package
Create a module-level logger in each module with get_logger(__name__), same as the usual stdlib convention logging.getLogger(__name__).
kloggy attaches its handler to the top-level package logger, i.e. the first dotted component of the name (pkg for pkg.sub.module).
Levels can be configured for the whole package or for individual modules as usual:
logging.getLogger('pkg').setLevel(logging.DEBUG) # all of pkg.*
logging.getLogger('pkg.module').setLevel(logging.WARNING) # just this module
Avoid get_logger(__package__):
- records lose their module name (
pkg.subinstead ofpkg.sub.module), so individual modules can't be configured - it's
''underpython -m(i.e. the root logger) andNonein a script run directly
Avoid logging via the root logger (logging.warning(...) etc.), use the module logger instead (ruff rule LOG015 catches these).
Such calls implicitly call basicConfig().
kloggy copes with that (Z3), but an app's own basicConfig(...) called later is then silently ignored.
Development
The tooling follows pymplate. Install tox with its uv plugin once:
uv tool install --with tox-uv tox
Run the local checks with:
tox -e ruff,format,tests,mypy,ty
For a targeted test run, use tox -e tests -- -k <pattern>.
The requirements doc is rendered from doc/requirements.qmd with Quarto, run tox -e quarto after changing it or the tests.
The rendered doc/requirements.md is committed, and CI checks it's up to date.
Releases
Pushes to the default branch publish to TestPyPI, and version tags such as v0.1.20261010 publish to PyPI, via GitHub Actions.
The setup (Trusted Publishing, release scripts in .ci/) follows pymplate.
Metadata
Release files for kloggy 0.0.20261010
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 |
|---|---|---|---|---|
| kloggy-0.0.20261010.tar.gz | 30.6 kB | Without provenance | Details for kloggy-0.0.20261010.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kloggy-0.0.20261010-py3-none-any.whl | Python 3 | none | any | Details for kloggy-0.0.20261010-py3-none-any.whl |
Total release size: 45.1 kB
Release files / kloggy-0.0.20261010.tar.gz
| Download URL | kloggy-0.0.20261010.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8eec19ff96a60d729899bff8f154bf1b7962d7aa89ad5717724f0ce5ad9d7841
|
|
BLAKE2b-256 checksum How to use checksums |
d734858bee6708a9938faaea13dbeda8aa9923b2be0aad609f6b23598d590740
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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 / kloggy-0.0.20261010-py3-none-any.whl
| Download URL | kloggy-0.0.20261010-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ce20e33710b4f0fe48ab5b44747caa2f6f296b54e668272e4e6886332c9b15b
|
|
BLAKE2b-256 checksum How to use checksums |
93a88274ec59c379b2d17b0d5f3705495f0e71159bf91ef272b4a4fdc164755e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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 kloggy 0.0.20261010
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.