reqlog

package module
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 9 Imported by: 32

README

Request logging middleware for bunrouter

See Logging requests for documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleware

func NewMiddleware(opts ...Option) bunrouter.MiddlewareFunc

Types

type Option

type Option func(m *middleware)

func FromEnv

func FromEnv(keys ...string) Option

WithEnv configures the middleware using the environment variable value. For example, WithEnv("BUNDEBUG"):

  • BUNDEBUG=0 - disables the middleware.
  • BUNDEBUG=1 - enables the middleware.
  • BUNDEBUG=2 - enables the middleware and verbose mode.

func WithEnabled

func WithEnabled(on bool) Option

WithEnabled enables/disables the middleware.

func WithVerbose

func WithVerbose(on bool) Option

WithVerbose configures the middleware to log all requests.

type ResponseWriter added in v1.0.14

type ResponseWriter struct {
	Wrapped http.ResponseWriter
	// contains filtered or unexported fields
}

func NewResponseWriter added in v1.0.14

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

func (*ResponseWriter) StatusCode added in v1.0.14

func (w *ResponseWriter) StatusCode() int

Jump to

Keyboard shortcuts

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