Code RoomStructured logging with trace context
MediumPrep Room Coding #4350

Structured logging with trace context

Vibe & agenticReliability & on-callMid–Senior~16 min

You're adding a structured logging helper to a Node/TypeScript service so logs flow cleanly into Datadog. You want an AI agent to write a `createLogger(context)` wrapper around `pino` that emits JSON, attaches a request-scoped trace ID, and redacts known PII fields. Write the prompt/spec you'd hand the agent so the result is correct on the first try — including the constraints, edge cases, and acceptance criteria. Then explain what a lazy one-line prompt ("write me a logger") would get wrong here.

Implement
redact_log_fields(entries: list[str], redact_keys: list[str]) → list[str]
Examples
in[["msg=login ok","user.password=hunter2","req.headers.authorization=Bearer abc"],["password","authorization"]]out["msg=login ok","user.password=[REDACTED]","req.headers.authorization=[REDACTED]"]
in[["payment.card.number=4111111111111111"],["card"]]out["payment.card.number=[REDACTED]"]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 16 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.