middleware

package
v3.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestFiberMiddlewareLogger

func RequestFiberMiddlewareLogger(logger *logrus.Logger, excludedPrefix []string) func(*fiber.Ctx) error

RequestFiberMiddlewareLogger is a fiber middleware to log all requests with logrus It logs the incoming request and when request is completed, adding latency of the request

func RequestGorillaMuxMiddlewareLogger

func RequestGorillaMuxMiddlewareLogger(logger *logrus.Logger, excludedPrefix []string) mux.MiddlewareFunc

RequestGorillaMuxMiddlewareLogger is a gorilla/mux middleware to log all requests with logrus It logs the incoming request and when request is completed, adding latency of the request

Types

type HTTP

type HTTP struct {
	Request  *Request  `json:"request,omitempty"`
	Response *Response `json:"response,omitempty"`
}

HTTP is the struct of the log formatter.

type Host

type Host struct {
	Hostname      string `json:"hostname,omitempty"`
	ForwardedHost string `json:"forwardedHost,omitempty"`
	IP            string `json:"ip,omitempty"`
}

Host has the host information.

type Request

type Request struct {
	Method    string                 `json:"method,omitempty"`
	UserAgent map[string]interface{} `json:"userAgent,omitempty"`
}

Request contains the items of request info log.

type Response

type Response struct {
	StatusCode int                    `json:"statusCode,omitempty"`
	Body       map[string]interface{} `json:"body,omitempty"`
}

Response contains the items of response info log.

type URL

type URL struct {
	Path string `json:"path,omitempty"`
}

URL info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL