Documentation ¶
Overview ¶
Package logrequest implements a middleware that logs requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogRequest ¶
type LogRequest struct { // Logger is the logger to use to log the requests. Logger httpcmw.Logger // RequestIDHeader is the name of the header that contains the request // ID. Defaults to X-Request-Id. RequestIDHeader string // TimeFormat is the format to use to format timestamps, as supported by // the time package. TimeFormat string // DurationFormat is the format to use to log the duration of the request. // The value to format is the number of seconds in float64. Defaults to // %.3f (milliseconds). DurationFormat string // Fields is the list of field names to log. Defaults to all supported // fields. The supported fields are: // // body_bytes_received: bytes received in the response body // duration: duration of the request // end: date and time of the end of the request (UTC) // error: error returned from the request, if any // host: host (and possibly port) of the request // method: method of the request (e.g. GET) // path: path section of the request URL // proto: protocol and version (e.g. HTTP/1.1) // query: query string section of the request URL // request_id: request id // start: date and time of the start of the request (UTC) // status: status code of the response, if any // user_agent: value of the User-Agent request header // Fields []string }
LogRequest holds the configuration for the LogRequest middleware.
Click to show internal directories.
Click to hide internal directories.