M2.5.1: Structured application logger (structlog) #24
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 2.5 — Logging & Cost Visibility, milestone 1.
Goal
A real, structured application logger across CLI, MCP server, and researcher. JSONL traces stay as-is (researcher audit trail); this is the parallel operational log for administrators.
Target sink eventually: OpenSearch (or similar). Format must be machine-ingestable from day one.
Backend
structlogwith:ConsoleRendererfor local/dev (colored, human-readable)JSONRendererfor prod (newline-delimited JSON, OpenSearch-ready)MARCHWARDEN_LOG_FORMAT=json|console(defaultconsoleif a TTY, elsejson)logging(anthropic SDK, mcp SDK, httpx) through the same pipeline viastructlog.stdlibScope
marchwarden/logging.py(~30 LOC) — one-timeconfigure_logging()callmarchwarden.climarchwarden.mcpmarchwarden.researcher.webMARCHWARDEN_LOG_LEVELenv var (defaultINFO); per-component overrides viaMARCHWARDEN_LOG_LEVEL_<COMPONENT>(optional, only if cheap)~/.marchwarden/logs/marchwarden.logcontrolled byMARCHWARDEN_LOG_FILE=1research()call, bindtrace_idandresearcherso every downstream log line carries them automaticallyConversion
Replace existing ad-hoc
printcalls and FastMCP defaults with structured log calls. Do NOT touch the JSONL trace logger — that's a separate concern.Tests
event,level,timestamp, bound context)Out of scope
marchwarden costscommand (M2.5.3)Branch
feat/structured-logging