How javajayjuice/boxlog works
boxlog is a structured logging library layered onto Python’s standard logging API. Applications emit records, optionally add contextual fields or bracket work with timing steps, and boxlog enriches/redacts and formats records before asynchronous batch delivery to configurable storage and stdout. Request middleware adds correlation IDs and request records. The stored logs are queried through either an embedded ASGI viewer or the standalone CLI, with a browser interface for filtering and live tail. The graph follows documented capabilities and indexed source references; several subsystem links rely on README documentation because their implementation was not sampled.
Main entry points: configure.py Logging Setup · formatter.py Format Records · viewer/__init__.py Viewer API · backends/__init__.py Backend Factory
Components 21
Record Processing
- Logging Setup
src/boxlog/configure.py - Record Helpers
src/boxlog/_record.py - Format Records
src/boxlog/formatter.py - Secret Redaction
src/boxlog/redaction.py - Async Shipper
src/boxlog/handler.py
Tracing and Requests
- Bound Context
src/boxlog/context.py - Timed Steps
src/boxlog/timing.py - Request Middleware
src/boxlog/middleware.py
Storage Backends
- Query Model
src/boxlog/query.py - Backend Factory
src/boxlog/backends/__init__.py - Backend Protocol
src/boxlog/backends/base.py - Memory Store
src/boxlog/backends/memory.py - SQLite Store
src/boxlog/backends/sqlite.py - Redis Store
src/boxlog/backends/redis.py
Log Viewer
- Viewer API
src/boxlog/viewer/__init__.py - Viewer CLI
src/boxlog/cli.py - Viewer Interface
src/boxlog/viewer/static/logs.js
Other components
- Python Application
- Python Logging
- Standard Output
- Log Viewer User
Connections 30
- Python Application → Python Logging: emits records
README.md - Python Logging → Async Shipper: routes records
README.md - Python Application → Logging Setup: configures logging
README.md - Logging Setup → Async Shipper: installs handler
src/boxlog/configure.py - Logging Setup → Format Records: configures format
src/boxlog/configure.py - Logging Setup → Secret Redaction: configures redaction
src/boxlog/configure.py - Logging Setup → Backend Factory: builds backend
src/boxlog/configure.py - Logging Setup → Standard Output: configures output
README.md - Python Application → Bound Context: binds fields
README.md - Python Application → Timed Steps: tracks work
README.md - Python Application → Request Middleware: adds middleware
README.md - Request Middleware → Bound Context: binds request ID
src/boxlog/middleware.py - Request Middleware → Python Logging: logs requests
src/boxlog/middleware.py - Format Records → Record Helpers: extracts fields
src/boxlog/formatter.py - Format Records → Bound Context: reads context
src/boxlog/formatter.py - Format Records → Secret Redaction: redacts values
src/boxlog/formatter.py - Async Shipper → Format Records: formats records
src/boxlog/handler.py - Async Shipper → Backend Protocol: appends batches
src/boxlog/handler.py - Backend Factory → Memory Store: creates backend
src/boxlog/backends/__init__.py - Backend Factory → SQLite Store: creates backend
src/boxlog/backends/__init__.py - Backend Factory → Redis Store: creates backend
src/boxlog/backends/__init__.py - Memory Store → Query Model: filters records
src/boxlog/backends/memory.py - SQLite Store → Query Model: filters records
src/boxlog/backends/sqlite.py - Redis Store → Query Model: filters records
src/boxlog/backends/redis.py - Log Viewer User → Viewer Interface: uses viewer
README.md - Viewer Interface → Viewer API: requests log data
README.md - Python Application → Viewer API: mounts viewer
README.md - Viewer CLI → Viewer API: serves standalone
src/boxlog/cli.py - Viewer API → Query Model: parses filters
src/boxlog/viewer/__init__.py - Viewer API → Backend Protocol: queries storage
src/boxlog/viewer/__init__.py