log2

package
v0.0.0-...-bfab8ab Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: BSD-3-Clause Imports: 11 Imported by: 5

Documentation

Index

Constants

View Source
const (
	InternalTraffic = "internal"
	EgressTraffic   = "egress"
	IngressTraffic  = "ingress"
)

Variables

View Source
var (
	PkgUri = reflect.TypeOf(any(pkg{})).PkgPath()
)

Functions

func AddRequestId

func AddRequestId(req *http.Request) string

AddRequestId - function copied from package httpx

func AnyAccess

func AnyAccess(traffic string, start time.Time, duration time.Duration, req *http.Request, resp *http.Response, threshold int, statusFlags string)

AnyAccess - needed for packages that have optional logging when core logging is not configured.

func DisableDebugAccessHandler

func DisableDebugAccessHandler()

func EgressAccess

func EgressAccess(start time.Time, duration time.Duration, req *http.Request, resp *http.Response, threshold int, statusFlags string)

func EnableDebugAccessHandler

func EnableDebugAccessHandler()

func HttpHostMetricsHandler

func HttpHostMetricsHandler(appHandler http.Handler, msg string) http.Handler

HttpHostMetricsHandler - handler for Http request metrics

func IngressAccess

func IngressAccess(start time.Time, duration time.Duration, req *http.Request, resp *http.Response, threshold int, statusFlags string)

func InternalAccess

func InternalAccess(start time.Time, duration time.Duration, req *http.Request, resp *http.Response, threshold int, statusFlags string)

func Log

func Log(ctx any, method, uri string, statusCode func() int) func()

Log - accessing logging for generic function calls

func NewStatusCodeClosure

func NewStatusCodeClosure(status **runtime.Status) func() int

func SetAccessHandler

func SetAccessHandler(fn AccessHandler)

func WrapBypass

func WrapBypass(handler runtime.DoHandler) runtime.DoHandler

WrapBypass - wrap a DoHandler with no logging

func WrapDo

func WrapDo(handler runtime.DoHandler) runtime.DoHandler

WrapDo - wrap a DoHandler with access logging

func WrapHttp

func WrapHttp(handler runtime.HttpHandler) runtime.HttpHandler

WrapHttp - wrap a HttpHandler with access logging

func WrapPost

func WrapPost(handler runtime.PostHandler) runtime.PostHandler

WrapPost - wrap a PostHandler with access logging

Types

type AccessHandler

type AccessHandler func(traffic string, start time.Time, duration time.Duration, req *http.Request, resp *http.Response, threshold int, statusFlags string)

AccessHandler - access logging handler

func GetAccessHandler

func GetAccessHandler() AccessHandler

type Controller2

type Controller2 interface {
	Apply(ctx any, r *http.Request, body any) (any, *runtime.Status)
}

Controller2 - an interface that manages resiliency for a runtime.TypeHandlerFn

func NewController2

func NewController2(handler runtime.DoHandler) Controller2

NewController2 - create a new access logging controller

Jump to

Keyboard shortcuts

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