← Back to Home

How to Use Structured Request Logging with Correlation IDs

Updated March 5, 2026
loggingcorrelation idstructured logsobservabilityhono

Structured Request Logging

Use a uniform log format and pass one reqId through all related calls.

Format

[reqId] [timestamp] [level] [component] message | key=value key2=value2

Logger Design

Route Wrapper Pattern

Wrap route handlers with lifecycle logging:

await runRoute(logger, reqId, { method, path }, async () => {
  // handler body
});

This gives:

What to Include