errorlog

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package errorlog 提供HTTP错误日志记录中间件功能 用于记录发生错误的HTTP请求,支持配置是否打印请求和响应

Package errorlog 提供HTTP错误日志记录中间件功能 用于记录发生错误的HTTP请求,支持配置是否打印请求和响应

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(opts ...Option) client.Middleware

Client 创建客户端错误日志中间件 该中间件捕获HTTP客户端调用的错误(4xx和5xx状态码),并记录错误日志

参数:

  • opts: 可选的配置选项

返回值:

  • client.Middleware: HTTP客户端中间件

func Server

func Server(opts ...Option) server.Middleware

Server 创建服务器端错误日志中间件 该中间件捕获HTTP请求的错误(4xx和5xx状态码),并记录错误日志

参数:

  • opts: 可选的配置选项

返回值:

  • server.Middleware: HTTP服务器中间件

Types

type Option

type Option func(o *options)

Option 是配置错误日志中间件的函数类型

func WithPrintRequest

func WithPrintRequest(print bool) Option

WithPrintRequest 设置是否打印请求 参数:

  • print: 是否打印请求

返回值:

  • Option: 配置选项

func WithPrintResponse

func WithPrintResponse(print bool) Option

WithPrintResponse 设置是否打印响应 参数:

  • print: 是否打印响应

返回值:

  • Option: 配置选项

Jump to

Keyboard shortcuts

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