routing

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 12 Imported by: 3

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 UpdateFuncInfo

func UpdateFuncInfo(ctx context.Context, funcInfo *FuncInfo)

UpdateFuncInfo updates a context's func info

func UpdatePanicError

func UpdatePanicError(ctx context.Context, err interface{})

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 interface{}, 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

Jump to

Keyboard shortcuts

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