accesslog

package
v0.0.0-...-202847b Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResponseStatus

func ResponseStatus(ctx context.Context, statusCode int) string

ResponseStatus checks the context for timeout, canceled, ok or error. Used in WithAccessLog().

func WithAccessLog

func WithAccessLog(x xstats.XStater, l ...log.Logger) mw.Middleware

WithAccessLog is a middleware that logs all access requests performed on the sub handler and uses github.com/rs/xstats for collecting stats. Default logger uses black hole engine. Log level must be set to info. Logger must be thread safe.

Types

type BlackholeXStat

type BlackholeXStat struct{}

BlackholeXStat provides a type to disable the stats.

func (BlackholeXStat) AddTags

func (BlackholeXStat) AddTags(tags ...string)

AddTags implements XStats interface

func (BlackholeXStat) Count

func (BlackholeXStat) Count(stat string, count float64, tags ...string)

Count implements XStats interface

func (BlackholeXStat) Gauge

func (BlackholeXStat) Gauge(stat string, value float64, tags ...string)

Gauge implements XStats interface

func (BlackholeXStat) Histogram

func (BlackholeXStat) Histogram(stat string, value float64, tags ...string)

Histogram implements XStats interface

func (BlackholeXStat) Timing

func (BlackholeXStat) Timing(stat string, duration time.Duration, tags ...string)

Timing implements xstats interface

Jump to

Keyboard shortcuts

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