zapx: Index | Files

package zhttp

import ""

Package zhttp provides zap extensions and middleware for Go's HTTP standard library.

TODO: examples


Package Files

doc.go http.go

type LogFields Uses

type LogFields []func(context.Context) zap.Field

LogFields customizes the fields logged

type Middleware Uses

type Middleware struct {
    // contains filtered or unexported fields

Middleware is the zapx/zhttp middleware client

func NewMiddleware Uses

func NewMiddleware(l *zap.Logger, f LogFields) *Middleware

NewMiddleware instantiates a middleware function that logs all requests using the provided logger

func (*Middleware) Logger Uses

func (m *Middleware) Logger(next http.Handler) http.Handler

Logger is basic logging middleware

func (*Middleware) Recoverer Uses

func (m *Middleware) Recoverer(next http.Handler) http.Handler

Recoverer is middleware for logging panics

Package zhttp imports 6 packages (graph) and is imported by 2 packages. Updated 2019-08-27. Refresh now. Tools for package owners.