Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Logger ¶
func Logger() gin.HandlerFunc
func LoggerWithConfig ¶
func LoggerWithConfig(config LoggerConfig) gin.HandlerFunc
Types ¶
type FieldsParams ¶
type FieldsParams struct { Request *http.Request // TimeStamp shows the time after the server returns a response. TimeStamp time.Time // StatusCode is HTTP response code. StatusCode int // Latency is how much time the server cost to process a certain request. Latency time.Duration // ClientIP equals Context's ClientIP method. ClientIP string // Method is the HTTP method given to the request. Method string // Path is a path the client requests. Path string // ErrorMessage is set if error has occurred in processing the request. ErrorMessage string // BodySize is the size of the Response Body BodySize int // Keys are the keys set on the request's context. Keys map[string]interface{} Option OptionalFieldsParams }
FieldsParams is the logrus Fields params·
type LogTransformer ¶
type LogTransformer func(logger *logrus.Logger, params FieldsParams)
type LoggerConfig ¶
type LoggerConfig struct { Logger *logrus.Logger Formatter LogTransformer SkipPaths []string Option OptionalFieldsParams }
LoggerConfig defines the config for Logger middleware.
Click to show internal directories.
Click to hide internal directories.