Add Request Info to Error Logs

Context

To increase visibility, error logs messages should include more of the information available at the time of logging.

Solution

app.logError has access to the http.Request object for the failed request, but we do not add any of the available info from this object to the log fields.

We can include any from the following not already included:

  • Method
  • URL
  • Header
  • Host
  • RemoteAddr

At minimum, including Method and URL would be convenient ways to filter errors in the logs.