DevLogBus

Python SDK

The Python SDK lives in:

sdk/python

It publishes to the DevLogBus HTTP API using only the Python standard library, so Python app records can appear beside backend, CLI, browser, journal, HTTP, and other SDK records. The default endpoint is:

http://127.0.0.1:7423

Install from PyPI:

python3 -m pip install devlogbus

Install from a checkout or release source archive when developing the SDK itself:

python3 -m pip install /path/to/DevLogBus/sdk/python

Client

from devlogbus import DevLogBusClient

devlog = DevLogBusClient(source="checkout_worker")

devlog.publish(
    level="INFO",
    message="checkout started",
    attrs={"request_id": "req-1"},
)

Pass endpoint explicitly for a different local or trusted-network daemon:

devlog = DevLogBusClient(
    endpoint="http://devbox:7423",
    source="checkout_worker",
)

Logging Handler

import logging
from devlogbus import DevLogBusLoggingHandler

logger = logging.getLogger("checkout")
logger.addHandler(DevLogBusLoggingHandler(source="checkout_worker"))
logger.warning("payment provider slow")

Filters And Redaction

Filters drop records before publishing. Redactors return the record shape that will be sent to the daemon.

from devlogbus import DevLogBusClient, drop_sources, redact_attrs

devlog = DevLogBusClient(
    source="checkout_worker",
    filter=drop_sources(["noisy_worker"]),
    redactor=redact_attrs(["authorization", "token", "request.apiKey"]),
)

redact_attrs matches either an attribute key or dotted nested path and replaces matching values with [REDACTED].

Local Test

From the repository root:

python3 -m unittest discover -s sdk/python/tests