loghttp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const RESPONSE_BODY_LOG_LIMIT = 1000

Maximum number of bytes of response body which will be logged.

Variables

This section is empty.

Functions

func LogMiddleware

func LogMiddleware(h http.Handler, infoLogger LogFunc, errorLogger LogFunc) http.Handler

Add an logging middleware to an http.Handler. For each HTTP request the middleware will call infoLogger if the status code indicates a successful HTTP request (1xx, 2xx, or 3xx). errorLogger will be called otherwise. The argument passed to infoLogger and errorLogger are intended to be logged by plog.LogAsJson or by logging the result of json.Marshal.

Types

type LogFunc

type LogFunc = func(map[string]interface{})

Jump to

Keyboard shortcuts

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