Note

Avoiding prettified logs

It’s common to pretty-print logs to stdout during development:

[10:42:18] INFO  Request started
  method: GET
  path: /api/posts
  requestId: req_123

Then switch to structured logs in production:

{"time":"2026-05-24T10:42:18.120Z","level":"info","message":"Request started","method":"GET","path":"/api/posts","requestId":"req_123"}JSON

Pretty logs are nice when an app is small, but they become painful once things scale. Thousands of lines fly past, terminal search only gets you so far (your scrollback needs to be set absurdly high), and when the terminal closes, the logs are gone.

I’ve started to prefer writing structured logs to disk during development. Send them over to something like Logdy (if you want something lightweight), or VictoriaLogs (if you want something a bit more capable).

Then you get the same filtering, grouping, and JSON-attribute goodness you rely on in production. It’s also very useful to be able to point your agent at the logs of an already running process.