← Back to Node.js performance map
🪵
Node.js Performance

Structured Logs

Log JSON with request IDs so performance issues can be searched.

logs

Detailed Description

Structured logs are machine-readable JSON events. They are easier to search, filter, group, and correlate than plain string logs.

For Node performance work, include request ID, trace ID, route, status code, duration, user or tenant context when safe, and error metadata. This turns logs into debugging data.

Mental Model

request id
-> log fields
-> trace id
-> searchable event

When To Use

  • ->Find slow requests by ID
  • ->Correlate application logs with traces
  • ->Avoid unsearchable string logs
Tools: pino, Winston, AsyncLocalStorage request context
structured-logs.js

Live Editor

Loading...

Output

Run code to see output...