logging

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestID

func GetRequestID(ctx context.Context) string

GetRequestID 从上下文中获取请求ID

func Logging

func Logging(opts ...Option) middleware.Middleware

Logging 返回一个日志中间件

Types

type Option

type Option func(*options)

Option 是日志中间件的选项

func WithLogRequestBody

func WithLogRequestBody(enabled bool) Option

WithLogRequestBody 设置是否记录请求体

func WithLogResponseBody

func WithLogResponseBody(enabled bool) Option

WithLogResponseBody 设置是否记录响应体

func WithLogger

func WithLogger(logger log.Logger) Option

WithLogger 设置日志记录器

func WithMaxBodyLogSize

func WithMaxBodyLogSize(size int) Option

WithMaxBodyLogSize 限制记录的请求/响应体大小

func WithSkipper

func WithSkipper(skipper Skipper) Option

WithSkipper 添加跳过日志记录的条件

type Skipper

type Skipper func(ctx context.Context, req interface{}) bool

Skipper 定义哪些请求应该跳过日志记录

Jump to

Keyboard shortcuts

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