Discover Packages
github.com/go-pkgz/rest
logger
package
Version:
v1.5.0
Opens a new window with list of versions in this module.
Published: Apr 6, 2020
License: MIT
Opens a new window with license information.
Imports: 12
Opens a new window with list of imports.
Imported by: 37 modules, 36 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.
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package logger implements logging middleware
Logger is a default logger middleware with "REST" prefix
func WithBody ¶
added in
v1.4.0
WithBody triggers request body logging. Body size is limited (default 1k)
type Backend interface {
Logf(format string , args ...interface{})
}
Backend is logging backend
type Middleware struct {
}
Middleware is a logger for rest requests.
New makes rest logger with given options
func (*Middleware) Handler ¶
Handler middleware prints http log
nolint gosec
Option func type
IPfn sets IP masking function. If ipFn is nil then IP address will be logged as is.
Log sets logging backend.
MaxBodySize sets size of the logged part of the request body.
Prefix sets log line prefix.
SubjFn triggers subject logging if subjFn is not nil.
UserFn triggers user name logging if userFn is not nil.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.