accesslog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 11 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditFunction

type AuditFunction func(rrwriter.RecordingResponseWriter)

AuditFunction is a function which will be called by a DynamicLogHandler after a HTTP request has been processed. It can be used for metrics by inspecting the state of the RecordingResponseWriter.

type DynamicLogHandler

type DynamicLogHandler interface {
	http.Handler
	// ToggleAccessLog controls which io.Writer accesslog is written to.
	// call (nil, w) to turn accesslog on a io.Writer on.
	// call (w, nil) to turn the accesslog of an io.Writer off
	// call (nil,nil) to turn accesslog completely off.
	// call (old,new) to atomically which accesslog from one io.Writer to another
	ToggleAccessLog(old, new io.Writer)
}

DynamicLogHandler is the interface of a logging http.Handler capable of turning on/off access log writing to multiple io.Writer

func NewDynamicLogHandler

func NewDynamicLogHandler(h http.Handler, af AuditFunction) DynamicLogHandler

NewDynamicLogHandler wraps around a provided handler and returns a DynamicLogHandler capable of turning accesslog on/off dynamically. If provided an AuditFunction it will be called after ServeHTTP on wrapped handler returns

Jump to

Keyboard shortcuts

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