On this page
SQLite-backed error log for recording and querying 5xx server responses with request context, tracebacks, and timestamps for post-mortem analysis.
#src.fastware.error_log
#src.fastware.error_log
SQLite-backed error log for recording and querying 5xx server responses with request context, tracebacks, and timestamps for post-mortem analysis.
Provides a simple append-only store that the request timing middleware can write to on server errors. Each entry captures enough context for dashboard display and post-mortem investigation.
Usage::
from fastware.error_log import ErrorLog
error_log = ErrorLog("errors.db") error_log.append( method="POST", path="/api/deploy", status_code=500, detail="Docker timeout", request_id="abc-123", )
#ErrorLog
Append-only SQLite error log.
Thread-safe: uses a lock around writes so concurrent ASGI tasks do not conflict.
Args:
path: Filesystem path for the SQLite database. Created on
first write if it does not exist.
#append
def append(self, *, method: str, path: str, status_code: int, detail: str='', request_id: str='', user: str='', traceback: str='') -> NoneAppend an error entry to the log.
#recent
def recent(self, limit: int=50) -> list[dict]Return the most recent limit error entries, newest first.