middleware

package
v0.0.0-...-d6a8468 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(decorateLogFunc func(requestLog *logger.Log, c *gin.Context)) gin.HandlerFunc

func LogFinish

func LogFinish(req interface{}) (resp interface{}, err error)

func LogStart

func LogStart(req interface{}) (resp interface{}, err error)

func Recovery

func Recovery() gin.HandlerFunc

Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.

func RequestID

func RequestID(c *gin.Context) string

func SetLog

func SetLog() gin.HandlerFunc

func SetRequestIdToContext

func SetRequestIdToContext() gin.HandlerFunc

Types

type LogFinishReq

type LogFinishReq struct {
	ReqRawLog    *logger.Log `json:"req_raw_log" plate:"req_raw_log,mid:full"`
	LogStartTime time.Time   `json:"log_start_time" plate:"log_start_time,mid:full"`
}

type LogMidReq

type LogMidReq struct {
	ReqId     string `json:"req_id" plate:"Req_id,header"`
	Method    string `json:"method" plate:"method,mid"`
	Path      string `json:"path" plate:"path,mid"`
	ParamName string `json:"param_name" plate:"param_name,mid"`
}

type LogMidResp

type LogMidResp struct {
	Logger       logger.Logger `json:"-" plate:"logger,mid"`
	ReqRawLog    *logger.Log   `json:"req_raw_log" plate:"req_raw_log,mid:full"`
	LogStartTime time.Time     `json:"log_start_time" plate:"log_start_time,mid:full"`
}

Jump to

Keyboard shortcuts

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