justapi — /docs

Text Logging

from justapi import init_logging

init_logging(level="info", format="text")

JSON Logging

from justapi import init_json_logging

init_json_logging()

Outputs structured JSON to stdout — ideal for production log aggregation.

File Logging

from justapi import init_file_logging

init_file_logging(path="logs/app.log")

JSON logging to a rolling file.

OpenTelemetry Tracing

from justapi import init_otlp_tracing

init_otlp_tracing(
    endpoint="http://localhost:4317",
    service_name="my-api",
)

Shutdown Tracing

from justapi import shutdown_tracing

# On app shutdown
shutdown_tracing()

Flushes all pending spans and shuts down the subscriber.

Read Trace Context

from justapi.tracing import get_current_trace_id, get_current_span_id

@app.get("/debug")
def debug():
    return {
        "trace_id": get_current_trace_id(),
        "span_id": get_current_span_id(),
    }

See Also

JustAPI v2.0.9 — Open Source MIT License · Built with WebTUI · GitHub

NORMAL master justapi/docs
utf-8 Top 1:1