Universal structured logging and observability for Node, Python, Go and Rust — built from the standard library only. Native batching, auto-redaction, OpenTelemetry-aware, with native Datadog and Elastic (ECS) formatters.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openinfra_logger-0.1.0.tar.gz.
File metadata
- Download URL: openinfra_logger-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acde60488056399d560c38a4cd04f68bca92c6c3dbdc693ae810379d74eaea8a
|
|
| MD5 |
1eafd7f2c88555ae02777e3e9dec37a6
|
|
| BLAKE2b-256 |
9d98271bffdcb69f3fea39def430cae59c7bb8a3817bafad4fa1072ab589bc93
|
Provenance
The following attestation bundles were made for openinfra_logger-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on jonathascordeiro20/openinfra-logger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openinfra_logger-0.1.0.tar.gz -
Subject digest:
acde60488056399d560c38a4cd04f68bca92c6c3dbdc693ae810379d74eaea8a - Sigstore transparency entry: 1551968934
- Sigstore integration time:
-
Permalink:
jonathascordeiro20/openinfra-logger@9f5919c04bf3d94cf31d27ead851ffc37e1b07e1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jonathascordeiro20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9f5919c04bf3d94cf31d27ead851ffc37e1b07e1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file openinfra_logger-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openinfra_logger-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97e9acfeb5ebbfefb3476e7cecc796a1ab68b2fe2b083453767d1ecbe1ebc409
|
|
| MD5 |
f2a5f19315de401314e43c6e29388290
|
|
| BLAKE2b-256 |
fbd1924a6b2ff4622a4db4fb40bf89be7f6ec55e6c92dd5b06f2192d8df73b76
|
Provenance
The following attestation bundles were made for openinfra_logger-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on jonathascordeiro20/openinfra-logger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openinfra_logger-0.1.0-py3-none-any.whl -
Subject digest:
97e9acfeb5ebbfefb3476e7cecc796a1ab68b2fe2b083453767d1ecbe1ebc409 - Sigstore transparency entry: 1551968947
- Sigstore integration time:
-
Permalink:
jonathascordeiro20/openinfra-logger@9f5919c04bf3d94cf31d27ead851ffc37e1b07e1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jonathascordeiro20
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@9f5919c04bf3d94cf31d27ead851ffc37e1b07e1 -
Trigger Event:
workflow_dispatch
-
Statement type: