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

routing

package
v3.1.61 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarkLongPolling

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

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

func NewLoggerHandler

func NewLoggerHandler() func(next http.Handler) http.Handler

NewLoggerHandler is a handler that will log routing to the router log taking account of routing information

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

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

type Printer

type Printer func(trigger Event, record *requestRecord)

Printer is used to output the log for a request

Source Files

  • context.go
  • funcinfo.go
  • logger.go
  • logger_manager.go
  • requestrecord.go

Jump to

Keyboard shortcuts

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