Documentation ¶
Index ¶
- func DoRequest(le *logrus.Entry, client *http.Client, req *http.Request, verbose bool) (*http.Response, error)
- func DoRequestWithClient(le *logrus.Entry, client HttpClient, req *http.Request, verbose bool) (*http.Response, error)
- func DoRequestWithTransport(le *logrus.Entry, transport http.RoundTripper, req *http.Request, verbose bool) (*http.Response, error)
- func LoggingMiddleware(next http.Handler, le *logrus.Entry, opts LoggingMiddlewareOpts) http.Handler
- func WithLoggerFields(le *logrus.Entry, r *http.Request, status int) *logrus.Entry
- type HttpClient
- type LoggedRoundTripper
- type LoggingMiddlewareOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoRequest ¶ added in v0.17.1
func DoRequest(le *logrus.Entry, client *http.Client, req *http.Request, verbose bool) (*http.Response, error)
DoRequest performs a request with logging.
If verbose=true, logs successful cases as well as errors. le can be nil to disable logging
func DoRequestWithClient ¶ added in v0.28.0
func DoRequestWithClient(le *logrus.Entry, client HttpClient, req *http.Request, verbose bool) (*http.Response, error)
DoRequestWithClient performs a request with logging.
If verbose=true, logs successful cases as well as errors. le can be nil to disable logging
func DoRequestWithTransport ¶ added in v0.26.0
func DoRequestWithTransport(le *logrus.Entry, transport http.RoundTripper, req *http.Request, verbose bool) (*http.Response, error)
DoRequestWithTransport performs a request with logging.
If verbose=true, logs successful cases as well as errors. le can be nil to disable logging
func LoggingMiddleware ¶
func LoggingMiddleware(next http.Handler, le *logrus.Entry, opts LoggingMiddlewareOpts) http.Handler
LoggingMiddleware logs incoming requests and response status codes using logrus.
Types ¶
type HttpClient ¶ added in v0.28.0
HttpClient can perform http requests.
func NewLoggedClient ¶ added in v0.28.0
func NewLoggedClient(le *logrus.Entry, client HttpClient, verbose bool) HttpClient
NewLoggedClient wraps an HttpClient with a logger.
type LoggedRoundTripper ¶ added in v0.26.0
type LoggedRoundTripper struct {
// contains filtered or unexported fields
}
LoggedRoundTripper is a custom RoundTripper that wraps an existing RoundTripper with a logger.
func NewLoggedRoundTripper ¶ added in v0.26.0
func NewLoggedRoundTripper(transport http.RoundTripper, le *logrus.Entry, verbose bool) *LoggedRoundTripper
NewLoggedRoundTripper creates a new instance of LoggedRoundTripper.
type LoggingMiddlewareOpts ¶ added in v0.14.2
type LoggingMiddlewareOpts struct { // UserAgent includes user agent in logs. UserAgent bool }
LoggingMiddlewareOpts are opts passed to LoggingMiddleware.