Help us shape the future of Go! Take the 2026 Go Developer Survey

routing

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestRecordInfo added in v1.3.0

func GetRequestRecordInfo(reqCtx context.Context) (ret struct {
	HasRecord     bool
	IsLongPolling bool
},
)

func MarkLogLevelTrace

func MarkLogLevelTrace(resp http.ResponseWriter, req *http.Request)

func MarkLongPolling

func MarkLongPolling() types.PreMiddlewareProvider

MarkLongPolling marks the request is a long-polling request, and the logger may output different message for it

func NewRequestInfoHandler added in v1.3.0

func NewRequestInfoHandler() func(next http.Handler) http.Handler

NewRequestInfoHandler is a handler that saves request info into request context. If router logger is enabled, it will also print request logs and detect slow requests.

func RecordFuncInfo

func RecordFuncInfo(ctx context.Context, funcInfo *FuncInfo) (end func())

RecordFuncInfo records a func info into context

func UpdatePanicError

func UpdatePanicError(ctx context.Context, err error)

UpdatePanicError updates a context's error info, a panic may be recovered by other middlewares, but we still need to know that.

Types

type Event

type Event int

Event indicates when the printer is triggered

const (
	// StartEvent at the beginning of a request
	StartEvent Event = iota

	// StillExecutingEvent the request is still executing
	StillExecutingEvent

	// EndEvent the request has ended (either completed or failed)
	EndEvent
)

type FuncInfo

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

FuncInfo contains information about the function to be logged by the router log

func GetFuncInfo

func GetFuncInfo(fn any, friendlyName ...string) *FuncInfo

GetFuncInfo returns the FuncInfo for a provided function and friendlyname

func (*FuncInfo) String

func (info *FuncInfo) String() string

String returns a string form of the FuncInfo for logging

Jump to

Keyboard shortcuts

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