Skip to main content

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.

Metadata

Release files for prairielog-handler 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prairielog-handler 0.2.0
File Size Uploaded
prairielog_handler-0.2.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prairielog-handler 0.2.0
File Interpreter ABI Platform
prairielog_handler-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / prairielog_handler-0.2.0.tar.gz

Download URL prairielog_handler-0.2.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
aa065132f36075a1512f50a055bc816e9a9d9305f36b35123756e4e56a3cd351
BLAKE2b-256 checksum
How to use checksums
e15d9790e06a6e8b137817130d21bc382df72d57bc3cd7cf204cc8ba7c3b8f2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / prairielog_handler-0.2.0-py3-none-any.whl

Download URL prairielog_handler-0.2.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d5e5e7298a622e38fbf4a4b62ccfbf2b892e89948332d0915275835480963f0
BLAKE2b-256 checksum
How to use checksums
e2b150f8564e5ec644ef85f159d3828ece79eac41d737803ebc0db6bb0f62403
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page