Problem
FastAPI services running AI agents and background workers often outgrow plain stdout logs long before a team wants to operate an ELK cluster or Jaeger stack. Developers still need to see which request triggered an error, how long each embedding or LLM step took, and what payloads reached the handler.
0x1LOG (0x1-log v1.4.5 on PyPI) mounts directly inside the FastAPI application at /0x1log/ behind a dashboard token, starting from one .0x1log/0x1log.db SQLite WAL file.
Approach & Architecture
- Zero-infrastructure default, scales when needed. Starts with one SQLite WAL + FTS5 database and zero external services, and switches to
postgresql://for multi-replica deployments ormode="lite"(memory:///redis://) for ephemeral workloads. - Negligible request overhead (~0.04 ms p95). ASGI middleware enqueues a compact dict onto a bounded in-memory queue and a background thread flushes batches, dropping safely with a visible counter rather than blocking requests.
- Smart Repeats, W3C tracing, and AI spans. Consecutive queue polls collapse into expandable repeat rows,
traceparentlinks FastAPI handlers to RQ and Celery jobs, and LLM/embedding spans capture model names and token counts.
flowchart TD
R["HTTP Request + traceparent"] --> M["ASGI Middleware ~0.04 ms"]
M --> Q["Bounded Queue"]
M --> H["FastAPI Handler unblocked"]
Q --> W["Background Batch Writer"]
W --> D[("SQLite FTS5 / Postgres / Redis")]
D --> U["Embedded Console /0x1log/"]
Quick start
import os
from dotenv import load_dotenv
from fastapi import FastAPI
from ox1log import observe
load_dotenv()
app = FastAPI()
observe(app, dashboard_token=os.environ.get("OX1LOG_TOKEN"))
MIT licensed, Python 3.10+.



