httplog

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MPL-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMode = Errors

Functions

This section is empty.

Types

type HeaderField added in v1.6.3

type HeaderField struct {
	Header string // request header name (canonical form)
	Field  string // log field name
}

type Logger

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

func NewLogger

func NewLogger(logFunc func(format string, args ...any), mode Mode) *Logger

NewLogger returns a logger that logs HTTP requests and responses.

func NewStructuredLogger added in v1.5.0

func NewStructuredLogger(logFunc func(msg string, args ...any), mode Mode) *Logger

NewStructuredLogger returns a logger that calls the same log function in a structured way.

func (*Logger) LogFunc

func (l *Logger) LogFunc() middleware.Logger

func (*Logger) WithRequestHeaders added in v1.6.3

func (l *Logger) WithRequestHeaders(h []HeaderField) *Logger

type Mode

type Mode string

Mode defines the logging verbosity.

const (
	None     Mode = "none"
	ShortURL Mode = "short-url"
	URL      Mode = "url"
	Headers  Mode = "headers"
	Body     Mode = "body"
	Errors   Mode = "errors"
)

func SplitNameMode added in v1.1.0

func SplitNameMode(val string) (name string, mode Mode, err error)

func (Mode) String

func (m Mode) String() string

Jump to

Keyboard shortcuts

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