logger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

type Flag int

Flag type

const (
	All Flag = iota
	User
	Body
	None
)

logger flags enum

type Middleware

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

Middleware for logging rest requests

func New

func New(options ...Option) Middleware

New makes rest Logger with given options

func (*Middleware) Handler

func (l *Middleware) Handler(next http.Handler) http.Handler

Handler middleware prints http log

type Option

type Option func(l *Middleware)

Option func type

func Flags

func Flags(flags ...Flag) Option

Flags functional option defines output modes

func IPfn

func IPfn(ipFn func(ip string) string) Option

IPfn functional option defines ip masking function.

func MaxBodySize

func MaxBodySize(max int) Option

MaxBodySize functional option defines the largest body size to log.

func Prefix

func Prefix(prefix string) Option

Prefix functional option defines log line prefix.

func UserFn

func UserFn(userFn func(r *http.Request) (string, error)) Option

UserFn functional option defines user name function.

Jump to

Keyboard shortcuts

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