Add structured backend logging with pino
CI / Checks (push) Successful in 47s
CI / Publish to npm registry (push) Successful in 50s

Wires leveled, structured logging (pretty in dev, JSON in prod) through
the server lifecycle, HTTP/WS request handling, run engine, auth, db,
and config loading. CLI command output is left untouched since it's
user-facing terminal UX, not backend logs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-19 09:54:16 +02:00
co-authored by Claude Sonnet 5
parent 3272b9db76
commit 96a66fc857
13 changed files with 420 additions and 16 deletions
+8
View File
@@ -5,6 +5,9 @@ import { requireAuth, unauthorizedResponse } from "@/lib/auth/guard";
import { getDb } from "@/lib/db/client";
import { runs } from "@/lib/db/schema";
import { cancelRun } from "@/lib/runner/registry";
import { logger } from "@/lib/logger";
const log = logger.child({ mod: "api" });
export async function POST(
request: Request,
@@ -27,11 +30,16 @@ export async function POST(
const cancelled = cancelRun(runId);
if (!cancelled) {
log.warn(
{ runId },
"cancel requested for a run not tracked by this process",
);
return Response.json(
{ error: "Run is not active in this server process" },
{ status: 409 },
);
}
log.info({ runId, requestedBy: auth.identity }, "cancel requested via API");
return Response.json({ status: "cancelling" }, { status: 202 });
}