Documentation

Overview

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

TODO: examples

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFields

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

LogFields customizes the fields logged

type Middleware

type Middleware struct {

	// contains filtered or unexported fields

}

Middleware is the zapx/zhttp middleware client

func NewMiddleware

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

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

func (*Middleware) Logger

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

Logger is basic logging middleware

func (*Middleware) Recoverer

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

Recoverer is middleware for logging panics

Source Files