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 ¶
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.
Click to show internal directories.
Click to hide internal directories.