{
  "id": 12464203,
  "title": "Node.js App Logging API: Structured JSON with Pino, Winston, and Request IDs",
  "url": "https://urgent.news/2026/10/06/node-js-app-logging-api-structured-json-with-pino-winston-and-request",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-06T20:41:33.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/gregorsterling9652/nodejs-app-logging-api-structured-json-with-pino-winston-and-request-ids-4kmf"
  },
  "original_language": "en",
  "account": "The article discusses the importance of logging in Node.js applications, particularly when using AI agents to research stories and write drafts. The author recommends using Pino or Winston libraries to produce structured JSON logs for each completed agent run. These logs should include essential information such as request_id, user_id, trace_id, environment, outcome, and iteration count.\n\nThe author emphasizes the need to avoid logging raw article text and full prompts, as this can introduce unnecessary noise into the logs and potentially expose sensitive reader or newsroom data. Instead, the focus should be on capturing essential metrics like latency_ms, cost_usd, and iterations.\n\nThe article also highlights the significance of request_id and user_id in distinguishing between retries, concurrent browser requests, and product-level investigations. A trace_id should be used to join related log records, but it should not be mistaken for a distributed tracing UI or queryable span tree.\n\nTo implement logging in a Node.js app, the author provides a runnable TypeScript example using the Pino library for local structured output. The example also includes sending the same completion event to a central logging API with proper error handling and retry mechanisms. The key takeaway is to treat the request as the unit of investigation and the completed agent loop as the unit of measurement when determining what to send to the structured JSON logging API.",
  "summary": "The useful trade-off is signal quality versus noise. TL;DR: in a Node.js app, use Pino or Winston to produce structured JSON logs, then send each completed AI agent run to a central logging API with a request ID and user ID. This gives a small media team a practical view of latency and cost without pretending that a log backend provides traces, alerts, replay, or an archive. Do less first. For an…",
  "key_points": [
    "Use Pino or Winston libraries for structured JSON logs in Node.js apps",
    "Include requestid, userid, traceid, environment, outcome, and iteration count",
    "Avoid logging raw article text and full prompts to prevent data exposure"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}