middleware

package
v6.5.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package middleware provides a customizable Kayvee logging middleware for HTTP servers.

logHandler := New(myHandler, myLogger, func(req *http.Request) map[string]interface{} {
	// Add Gorilla mux vars to the log, just because
	return mux.Vars(req)
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeaderHandler

func HeaderHandler(headers ...string) func(*http.Request) map[string]interface{}

HeaderHandler takes in any amount of headers and returns a handler that adds those headers.

func New

func New(h http.Handler, source string, handlers ...func(*http.Request) map[string]interface{}) http.Handler

New takes in an http Handler to wrap with logging, the logger source name to use, and any amount of optional handlers to customize the data that's logged. On every request, the middleware will create a logger and place it in req.Context().

Types

This section is empty.

Jump to

Keyboard shortcuts

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