Documentation
¶
Index ¶
- Variables
- func Access(r *http.Request, start time.Time, statusCode int)
- func AccessError(r *http.Request, start time.Time, err error)
- func Application(h http.Header) *logrus.Entry
- func Cacheinfo(url string, hit bool)
- func Call(r *http.Request, resp *http.Response, start time.Time, err error)
- func EnsureCorrelationId(r *http.Request) string
- func GetCorrelationId(h http.Header) string
- func GetUserCorrelationId(h http.Header) string
- func LifecycleStart(appName string, args interface{})
- func LifecycleStop(appName string, signal os.Signal, err error)
- func Set(level string, textLogging bool) error
- type LogMiddleware
- type LogOption
Constants ¶
This section is empty.
Variables ¶
var AccessLogCookiesBlacklist []string
The of cookies which should not be logged
var AnonymizedQueryParams []string
List of query params that should be anonymized
var CorrelationIdHeader = "X-Correlation-Id"
var LifecycleEnvVars = []string{"BUILD_NUMBER", "BUILD_HASH", "BUILD_DATE"}
var Logger *logrus.Logger
var UserCorrelationIdHeader = "X-User-Correlation-Id"
Functions ¶
func AccessError ¶
AccessError logs an error while accessing
func Application ¶
Return a log entry for application logs, pre-filled with the correlation ids out of the supplied request.
func EnsureCorrelationId ¶
EnsureCorrelationId returns the correlation from of the request. If the request does not have a correlation id, one will be generated and set to the request.
func GetCorrelationId ¶
GetCorrelationId returns the correlation from of the request.
func GetUserCorrelationId ¶ added in v2.2.0
GetCorrelationId returns the correlation from of the request.
func LifecycleStart ¶
func LifecycleStart(appName string, args interface{})
LifecycleStart logs the start of an application with the configuration struct or map as paramter.
func LifecycleStop ¶
LifecycleStop logs the stop of an application
Types ¶
type LogMiddleware ¶
func NewLogMiddleware ¶
func NewLogMiddleware(next http.Handler, options ...LogOption) *LogMiddleware
NewLogMiddleware returns a new log handler wrapping a given handler. Further configuration can be done by passing relevant option functions.
func (*LogMiddleware) ServeHTTP ¶
func (mw *LogMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
type LogOption ¶
type LogOption func(*LogMiddleware)
func WithPanicStatus ¶
WithPanicStatus modifies the middleware so that it reponds with a given statuscode if a panic occurs. Respectively not setting this will not modify the response code in any way.