hm

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestMethod = map[string]uint32{
	"GET":    1,
	"POST":   2,
	"PUT":    3,
	"DELETE": 4,
}

Functions

func NewAccessLogger

func NewAccessLogger(handle func(b []byte, msg string)) func(next http.Handler) http.Handler

NewAccessLogger 访问日志中间件 handle 接收两类日志:b 为结构化 JSON,msg 为人类可读文本行; 字段包含 path/request/response/duration/status/trace_id 等,便于统一采集。

Types

type HttpStatusResponseWriter

type HttpStatusResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

HttpStatusResponseWriter 它主要由中间件(例如访问日志记录器)使用

func (*HttpStatusResponseWriter) Write

func (w *HttpStatusResponseWriter) Write(b []byte) (int, error)

func (*HttpStatusResponseWriter) WriteHeader

func (w *HttpStatusResponseWriter) WriteHeader(code int)

Jump to

Keyboard shortcuts

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