Documentation ¶
Index ¶
- func Correlation(c *CorrelationConfig) func(http.Handler) http.Handler
- func NotFound(next http.Handler) http.Handler
- func RequestLogger(c *RequestLoggerConfig) func(http.Handler) http.Handler
- func ResponseLogger(c *ResponseLoggerConfig) func(http.Handler) http.Handler
- type CorrelationConfig
- type RequestLogData
- type RequestLoggerConfig
- type ResponseLogData
- type ResponseLoggerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Correlation ¶
func Correlation(c *CorrelationConfig) func(http.Handler) http.Handler
Correlation
func RequestLogger ¶
func RequestLogger(c *RequestLoggerConfig) func(http.Handler) http.Handler
RequestLogger returns the request logger middleware
func ResponseLogger ¶
func ResponseLogger(c *ResponseLoggerConfig) func(http.Handler) http.Handler
ResponseLogger returns the response logger middleware
Types ¶
type CorrelationConfig ¶
type CorrelationConfig struct { // ContextKey for storing correlation data in context locals ContextKey trace.ContextKey // Generator defines a function to generate request identifier Generator func() string // Header key for trace ID get/set Header string // Next defines a function to skip this middleware on return true Next func(r *http.Request) bool }
CorrelationConfig
type RequestLogData ¶
type RequestLogData struct { Body map[string]any ClientIP string Headers http.Header Method string Path string }
RequestLogData defines the data captured for request logging
type RequestLoggerConfig ¶
type RequestLoggerConfig struct { Logger *cl.CustomLogger `validate:"required"` Next func(r *http.Request) bool }
RequestLoggerConfig defines necessary components for the request logger middleware
type ResponseLogData ¶
type ResponseLogData struct { Body map[string]any BodySize *int Headers http.Header ResponseTime string Status int }
ResponseLogData defines the data captured for response logging
type ResponseLoggerConfig ¶
type ResponseLoggerConfig struct { Logger *cl.CustomLogger `validate:"required"` Next func(r *http.Request) bool }
ResponseLoggerConfig defines necessary components for the response logger middleware
Click to show internal directories.
Click to hide internal directories.