logger

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFormat

type LogFormat int

LogFormat is the format of the log output, compatible with the new slog package.

const (
	TextFormat LogFormat = iota // This is the default format
	JSONFormat                  // Log in JSON format
)

type LoggerMiddleware

type LoggerMiddleware struct {
	Output  io.Writer
	Format  LogFormat
	LogIP   bool
	Skip    []string
	Options *slog.HandlerOptions
}

LoggerMiddleware is a middleware that logs the request and response information.

func New

func New(output io.Writer, skip ...string) *LoggerMiddleware

New creates a new LoggerMiddleware with the specified configuration.

func (*LoggerMiddleware) Logger

func (l *LoggerMiddleware) Logger(handler http.Handler) http.Handler

Logger is the middleware handler function for LoggerMiddleware.

Jump to

Keyboard shortcuts

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