mw

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Message = "request completed"

Variables

This section is empty.

Functions

This section is empty.

Types

type SlogLogger

type SlogLogger struct {
	// contains filtered or unexported fields
}

SlogLogger is an idiomatic middleware to log requests using slog logger.

func NewSlogLogger

func NewSlogLogger(next http.Handler, log *slog.Logger) *SlogLogger

func (*SlogLogger) ServeHTTP

func (l *SlogLogger) ServeHTTP(res http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface.

type ZapLogger

type ZapLogger struct {
	// contains filtered or unexported fields
}

SlogLogger is an idiomatic middleware to log requests using zap logger.

func NewZapLogger

func NewZapLogger(next http.Handler, log *zap.Logger) *ZapLogger

func (*ZapLogger) ServeHTTP

func (l *ZapLogger) ServeHTTP(res http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface.

Jump to

Keyboard shortcuts

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