OpenInfra Logger — Python
OpenInfra Logger is a zero-dependency, structured logging library — built from the Python standard library only — with native batching, auto-redaction, OpenTelemetry trace injection, and Datadog/Elastic formatters.
The same JSON shape is emitted by sibling implementations for Node.js, Go and Rust, making polyglot stacks observable with a single log format.
Install
pip install openinfra-logger
Quickstart
from openinfra_logger import log, configure
log("System initialized", "info")
log("Failed to parse payload", "error", {"request_id": "abc-123"})
File + remote with batching
from openinfra_logger import log, configure
configure(
transports=["console", "file", "remote"],
file_path="./production.log",
remote_url="https://logs.my-infrastructure.com/ingest",
default_metadata={"service": "payment-gateway", "env": "production"},
batch_size=100,
flush_interval_ms=2000,
)
log("Payment processed", "info", {"transaction_id": "abc-456"})
Datadog / Elastic formatters
configure(formatter="datadog") # renames level → status, trace_id → dd.trace_id
# configure(formatter="elastic") # renames timestamp → @timestamp, level → log.level
Auto-redaction (LGPD / GDPR)
Sensitive keys (password, token, secret, api_key, credit_card) are recursively replaced with [REDACTED] before any transport sees the entry. Case-insensitive on key names. Override via redact_keys=[...] in configure(...).
log("Login", "info", {"user": "alice", "password": "p@ss"})
# → "...","user":"alice","password":"[REDACTED]"
OpenTelemetry tracing
If an OTel span is active in the current context, trace_id and span_id are picked up automatically. Install the optional extra to enable detection:
pip install "openinfra-logger[opentelemetry]"
Links
- Source — https://github.com/jonathascordeiro20/openinfra-logger
- Issues — https://github.com/jonathascordeiro20/openinfra-logger/issues
- Changelog — https://github.com/jonathascordeiro20/openinfra-logger/blob/main/CHANGELOG.md
- Project site — https://openinfralogger.fun
License
MIT — see LICENSE.
Metadata
Release files for openinfra-logger 0.1.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 | |
|---|---|---|---|
| openinfra_logger-0.1.0.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openinfra_logger-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / openinfra_logger-0.1.0.tar.gz
| Download URL | openinfra_logger-0.1.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acde60488056399d560c38a4cd04f68bca92c6c3dbdc693ae810379d74eaea8a
|
|
BLAKE2b-256 checksum How to use checksums |
9d98271bffdcb69f3fea39def430cae59c7bb8a3817bafad4fa1072ab589bc93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 16, 2026.
Transparency logRelease files / openinfra_logger-0.1.0-py3-none-any.whl
| Download URL | openinfra_logger-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97e9acfeb5ebbfefb3476e7cecc796a1ab68b2fe2b083453767d1ecbe1ebc409
|
|
BLAKE2b-256 checksum How to use checksums |
fbd1924a6b2ff4622a4db4fb40bf89be7f6ec55e6c92dd5b06f2192d8df73b76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 16, 2026.
Transparency log