bookkeeping

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Code

func Code(response CapturedResponse) []interface{}

func New

func New(options ...Option) func(next http.Handler) http.Handler

func RequestBody

func RequestBody(request *http.Request) []interface{}

func ResponseBody

func ResponseBody(response CapturedResponse) []interface{}

Types

type CapturedResponse

type CapturedResponse struct {
	Code    int
	Payload []byte
	Header  http.Header
}

type Option

type Option func(h *handler)

Option provides a single configuration option for a bookkeeping handler

func WithRequests

func WithRequests(requestFuncs ...RequestFunc) Option

WithRequests take a one or many RequestFuncs to build an Option for logging key value pairs from the RequestFun

func WithResponses

func WithResponses(responseFuncs ...ResponseFunc) Option

WithResponses take a one or many ResponseFunc to build an Option for logging key value pairs from the ResponseFunc

type RequestFunc

type RequestFunc func(request *http.Request) []interface{}

RequestFunc takes the request and returns key value pairs from the request

func RequestHeaders

func RequestHeaders(headers ...string) RequestFunc

func RequestHeadersWithPrefix

func RequestHeadersWithPrefix(headers ...string) RequestFunc

type ResponseFunc

type ResponseFunc func(response CapturedResponse) []interface{}

ResponseFunc takes the ResponseWriter and returns key value pairs from the request

func ResponseHeaders

func ResponseHeaders(headers ...string) ResponseFunc

func ResponseHeadersWithPrefix

func ResponseHeadersWithPrefix(headers ...string) ResponseFunc

Jump to

Keyboard shortcuts

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