loggermiddleware

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MethodFieldName = "method"
View Source
var PathFieldName = "path"
View Source
var RequestIdFieldName = "request-id"

Functions

func AddCustomJsonLogField added in v0.4.0

func AddCustomJsonLogField(logFieldName string, valueExtractor func(r *http.Request) string)

AddCustomJsonLogField is a function to add custom fields to json logs.

The first parameter determines the name of the field. The second parameters is used to determine the value of the field from the logged request. Each invocation adds one extra field.

func AddZerologLoggerToContext

func AddZerologLoggerToContext(next http.Handler) http.Handler

AddZerologLoggerToContext is a middleware to add a context aware logger to your context.

also supports logging request ids, just assign RequestIdFromContextRetriever before using this

Types

This section is empty.

Jump to

Keyboard shortcuts

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