Python logging handler for PrairieLog ingestion.
Project description
PrairieLog Python Handler
Small logging.Handler for Python services. It batches records through POST /api/v1/kafka/log-events/batch — the Kafka-backed ingestion pipeline that also drives alert aggregation, analysis, and Slack/Discord delivery — maps Python log levels to PrairieLog levels, and flushes on demand.
If the server answers HTTP 503 (Kafka integration disabled or broker unavailable), the handler automatically falls back to the synchronous POST /api/v1/log-events/batch endpoint so logs are never lost — but that endpoint has no alerting side effect, so alerts are degraded until Kafka is back. The fallback is reported once per outage on stderr.
pip install prairielog-handler
For local development from this repository, use pip install ./frontend/sdk/python.
import logging
from prairielog_handler import PrairieLogHandler
handler = PrairieLogHandler(
api_url="https://log-stream-service.onrender.com",
ingestion_token="YOUR_INGESTION_TOKEN",
logger_name="checkout-worker",
)
logging.getLogger().addHandler(handler)
logging.error("Payment failed", extra={"orderId": "ord_123"})
Call handler.flush() before process shutdown when you cannot rely on normal logging cleanup.
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 prairielog_handler-0.2.0.tar.gz.
File metadata
- Download URL: prairielog_handler-0.2.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa065132f36075a1512f50a055bc816e9a9d9305f36b35123756e4e56a3cd351
|
|
| MD5 |
2b9d4e8b8b965a73c784182c3e6a4ab5
|
|
| BLAKE2b-256 |
e15d9790e06a6e8b137817130d21bc382df72d57bc3cd7cf204cc8ba7c3b8f2b
|
File details
Details for the file prairielog_handler-0.2.0-py3-none-any.whl.
File metadata
- Download URL: prairielog_handler-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d5e5e7298a622e38fbf4a4b62ccfbf2b892e89948332d0915275835480963f0
|
|
| MD5 |
f31113068297e797f9f663bf28c0648f
|
|
| BLAKE2b-256 |
e2b150f8564e5ec644ef85f159d3828ece79eac41d737803ebc0db6bb0f62403
|