Spec a pino logger with request ids and redaction
Your task
Your Node and TypeScript API logs with console.log, and the logs reach Datadog as plain text. Nobody can follow one request through them, and a support engineer recently found a customer's password in a log line. An agent will write a logger module on top of pino and move the service to it.
Write the spec you would hand the agent.
What you know:
- Express 4 on Node 22; the load balancer sets an
x-request-idheader on every request - logs go to stdout, and the Datadog agent ships them
- your Datadog setup reads a field named
levelas the status when it holds a name such asinfo - request bodies include
password,tokenandcardfields, sometimes nested one level deep
Then, in a few sentences: what does "write me a logger" get wrong?