Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger struct { Skipper func(r *http.Request) bool PreFunc func(r *http.Request) *http.Request PostFunc func(r *http.Request, v *Response) }
Logger is a middleware that logs HTTP requests and additional information to context.
type Option ¶
type Option func(*option)
func WithLogger ¶ added in v0.1.5
WithLogger sets a custom Logger directly.
func WithPostFunc ¶ added in v0.1.5
WithPostFunc sets a function which is called after the request is processed.
- This will override the default PostFunc which logs some useful information.
func WithPreFunc ¶ added in v0.1.5
WithPreFunc sets a function which is called before the request is processed.
- This will override the default PreFunc which adds some useful information to the context.
type Response ¶ added in v0.1.5
type Response struct { // StartTime is time recorded before next middleware/handler is executed. StartTime time.Time // Latency is duration it took to execute rest of the handler chain (next(c) call). Latency time.Duration // Status is response status code. Then handler returns an echo.HTTPError then code from there. Status int // ResponseSize is response content length value. Note: when used with Gzip middleware this value may not be always correct. ResponseSize int64 }
Response contains extracted values from logger.
Click to show internal directories.
Click to hide internal directories.