logrequest

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TargetResponseTime = 1 * time.Second

TargetResponseTime sets the threshold for colorisation of response times

Functions

func Middleware

func Middleware(h http.HandlerFunc) http.HandlerFunc

Middleware logs after each request to record to log.Printf the method, the url, the status code and the response time e.g. GET / -> status 200 in 31.932146ms With coloration to indicate status and response time If ValueLoggers are set the values are also sent to log.Values

func MiddlewarePrint added in v1.6.7

func MiddlewarePrint(h http.HandlerFunc) http.HandlerFunc

MiddlewarePrint logs after each request to record to log.Printf the method, the url, the status code and the response time e.g. GET / -> status 200 in 31.932146ms With coloration to indicate status and response time No data is sent to value loggers

Types

This section is empty.

Jump to

Keyboard shortcuts

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