accesslog

package
v0.0.0-...-2cadb06 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLog

type AccessLog struct {
	//http 请求类型
	Method string
	//url 整个请求的url
	Url string
	//请求体
	RequestBody string
	//响应体
	ResponseBody string
	//处理时间
	Duration string
	//状态码
	Status int
}

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) Build

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

Build 构建中间件

func (*MiddleWareBuilder) MaxLength

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

MaxLength 打印的最大长度

Jump to

Keyboard shortcuts

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