logger

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default(l *zap.Logger) gin.HandlerFunc

Types

type AccessLog

type AccessLog struct {
	Duration     string
	Method       string
	Url          string
	Status       int
	RequestBody  string
	ResponseBody string
}

AccessLog 请求日志

type MiddleWareBuilder

type MiddleWareBuilder struct {
	// contains filtered or unexported fields
}

MiddleWareBuilder 日志打印中间件

func NewBuilder

func NewBuilder(loggerFunc func(ctx context.Context, log *AccessLog)) *MiddleWareBuilder

NewBuilder 创建日志打印中间件构造器

func (*MiddleWareBuilder) AllowRequestBody

func (b *MiddleWareBuilder) AllowRequestBody(flag bool) *MiddleWareBuilder

AllowRequestBody 允许打印请求体

func (*MiddleWareBuilder) AllowResponseBody

func (b *MiddleWareBuilder) AllowResponseBody(flag bool) *MiddleWareBuilder

AllowResponseBody 允许打印响应体

func (*MiddleWareBuilder) BodyLength

func (b *MiddleWareBuilder) BodyLength(length int) *MiddleWareBuilder

BodyLength 设置请求体最大长度

func (*MiddleWareBuilder) Build

func (b *MiddleWareBuilder) Build() gin.HandlerFunc

Build 构建中间件

func (*MiddleWareBuilder) UrlLength

func (b *MiddleWareBuilder) UrlLength(length int) *MiddleWareBuilder

UrlLength 设置url最大长度

Jump to

Keyboard shortcuts

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