Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct {
}
Middleware is an object that performs logging. NOTE: while it appears to do nothing, it does allow easy addition of configuration, works the same as everything else, ensuring we don't alloate it all the time, and it actually shows up in pprof traces rather than some anonymous closure.
func (*Middleware) Middleware ¶
func (m *Middleware) Middleware(next http.Handler) http.Handler
Middleware provides an adaptor into chi's routing stack.
type RequestLog ¶
type RequestLog struct {
// Protocol is the HTTP protocol e.g. HTTP/2.
Protocol string `json:"protocol,omitempty"`
// Scheme is the HTTP scheme in use e.g. https.
Scheme string `json:"scheme,omitempty"`
// Method is the HTTP method e.g. GET
Method string `json:"method,omitempty"`
// Path is the HTTP URL's path.
Path string `json:"path,omitempty"`
// Host is the host that was requested as defined by HTTP/1.1.
Host string `json:"host,omitempty"`
// Query is the HTTP query string.
Query string `json:"query,omitempty"`
// Fragment is the HTTP fragment string.
Fragment string `json:"fragment,omitempty"`
// Length is the request's content length.
Length int64 `json:"length,omitempty"`
// Address is the address that made the connection.
// NOTE: this should always be an API gateway of some variety.
Address string `json:"address,omitempty"`
// Headers is the set of HTTP headers requested by the client.
Headers http.Header `json:"headers,omitempty"`
}
RequestLog wraps up the request log formatting so it's printed in a deterministic and sane order.
type ResponseLog ¶
type ResponseLog struct {
// Code is the HTTP status code.
Code int `json:"code"`
// Length is the response's content length.
Length int64 `json:"length"`
// TimeNS records the time in nanoseconds the request took to be processed.
TimeNS int64 `json:"timeNs"`
// Headers is the set of HTTP headers send by the server.
Headers http.Header `json:"headers,omitempty"`
}
ResponseLog wraps up the response log formatting so it's printed in a deterministic and sane order.
Click to show internal directories.
Click to hide internal directories.