Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessLog ¶
type AccessLog struct {
LogId string `json:"id"` // 请求id
Path string `json:"path"` // 请求路径
Method string `json:"method"` // 请求方法
Query string `json:"query"` // 请求参数
Proto string `json:"proto"` // 请求协议
Headers http.Header `json:"headers"` // 请求头
ReqBody string `json:"req_body"` // 请求体
ClientIP string `json:"client_ip"` // 客户端IP
Status int `json:"status"`
RespBody string `json:"resp_body"` // 响应体
RespHeader http.Header `json:"resp_header"` // 响应头
StartTime int64 `json:"start_time"`
StopTime int64 `json:"stop_time"`
Duration int64 `json:"duration"` // 请求耗时
}
func (*AccessLog) ReqLogPrint ¶
ReqLogPrint 请求日志打印
func (*AccessLog) RespLogPrint ¶
RespLogPrint 响应日志打印
type GinLogx ¶
type GinLogx struct {
// contains filtered or unexported fields
}
func NewGinLogx ¶
NewGinLogx 自定义Gin日志中间件【基于zeroLog高性能日志库】
func (*GinLogx) AllowReqBody ¶
AllowReqBody 允许打印请求体
func (*GinLogx) AllowRespBody ¶
AllowRespBody 允许打印响应体
func (*GinLogx) BuildGinHandlerLog ¶
func (g *GinLogx) BuildGinHandlerLog() gin.HandlerFunc
ZerologLogger 自定义Gin日志中间件
- 【注意,中间件需在gin的Handler注册中间件最前,否则可能会获取不到请求内容】
func (*GinLogx) SetMaxBodySize ¶
SetMaxBodySize 设置请求体和响应体最大读取大小(字节)
Click to show internal directories.
Click to hide internal directories.