Hacker News new | ask | show | jobs
by georgekin 1720 days ago
Another option is to log after, but in a cross cutting way, e.g. using a middleware or filter. Extra properties can be added along the way, and if there's an exception the middleware can handle it and add the problem to the log event.

The power of structured logging here is in enriching events to make them queryable later, so you could e.g. view all events for a request.