commonadapter

package
v0.0.0-...-1413bf2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextExtractor

type ContextExtractor func(ctx context.Context) map[string]interface{}

ContextExtractor extracts log fields from a context.

type Logger

type Logger struct {
	logur.LoggerFacade
	// contains filtered or unexported fields
}

Logger wraps a logur logger and exposes it under a custom interface.

func NewContextAwareLogger

func NewContextAwareLogger(logger logur.LoggerFacade, extractor ContextExtractor) *Logger

NewContextAwareLogger returns a new Logger instance that can extract information from a context.

func NewLogger

func NewLogger(logger logur.LoggerFacade) *Logger

NewLogger returns a new Logger instance.

func (*Logger) WithContext

func (l *Logger) WithContext(ctx context.Context) common.Logger

WithContext annotates a logger with a context.

func (*Logger) WithFields

func (l *Logger) WithFields(fields map[string]interface{}) common.Logger

WithFields annotates a logger with key-value pairs.

Jump to

Keyboard shortcuts

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