logger

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchPath

func MatchPath(path string, pattern string) bool

MatchPath matches exact paths, directory prefixes, and simple * wildcards.

func New

func New(configs ...Config) route.Middleware

New creates logger middleware.

func ShouldSkip

func ShouldSkip(ctx *route.Context, next func(*route.Context) bool, patterns ...string) bool

ShouldSkip reports whether an HTTP access log should be skipped.

Types

type Config

type Config struct {
	Next      func(*route.Context) bool
	SkipPaths []string
	Channel   string
	Fields    []string
	Slow      time.Duration
	OnLogged  func(*route.Context, Entry) error
}

Config configures logger middleware.

type Entry

type Entry struct {
	RequestID string
	Method    string
	Path      string
	Status    int
	IP        string
	Latency   time.Duration
	Error     error
	Slow      bool
}

Entry is an HTTP access log entry.

Jump to

Keyboard shortcuts

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