glimr/http/middleware/log_request

Log Request Middleware

Without centralized request logging, every handler would need its own log call to track incoming requests — that’s both repetitive and fragile since a forgotten log means blind spots in production. Placing logging as middleware ensures every request is recorded regardless of which handler serves it.

Values

pub fn run(
  ctx: context.Context(app),
  next: fn(context.Context(app)) -> response.Response(wisp.Body),
) -> response.Response(wisp.Body)

The use callback wraps the downstream chain so the logger captures both the request method and path along with the response status code in one log entry. Placing it early in the pipeline ensures even requests that fail in later middleware steps are still logged for debugging.

Search Document