Documentation ¶
Index ¶
- Constants
- func Middleware(notlogged ...string) gin.HandlerFunc
- func MiddlewareCorrelationId(opts ...MiddlewareOption) gin.HandlerFunc
- func NewLogger(config Config) logur.Logger
- func WithFields(logger logur.Logger, fields map[string]interface{}) logur.Logger
- func WithFieldsForHandlers(ctx *gin.Context, logger logur.Logger, fields map[string]interface{}) logur.Logger
- type Config
- type Header
- type MiddlewareOption
Constants ¶
View Source
const ContextKey = "correlationid"
ContextKey is the key the retrieved (or generated) correlation ID is stored under in the gin Context.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(notlogged ...string) gin.HandlerFunc
Middleware returns a gin compatible handler.
func MiddlewareCorrelationId ¶
func MiddlewareCorrelationId(opts ...MiddlewareOption) gin.HandlerFunc
MiddlewareCorrelationId returns a gin compatible handler.
func WithFields ¶
WithFields returns a new contextual logger instance with context added to it.
Types ¶
type Config ¶
type Config struct { // Format specifies the output log format. // Accepted values are: json, logfmt Format string // Level is the minimum log level that should appear on the output. Level string // NoColor makes sure that no log output gets colorized. NoColor bool }
Config holds details necessary for logging.
type Header ¶
type Header string
Header configures the header from where the correlation ID will be retrieved.
type MiddlewareOption ¶
type MiddlewareOption interface {
// contains filtered or unexported methods
}
MiddlewareOption configures the correlation ID middleware.
Click to show internal directories.
Click to hide internal directories.