log

package
v5.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyCorrelationID const is the context key for Correlation ID
	KeyCorrelationID ctxKey = "X-Correlation-ID"
)

Variables

This section is empty.

Functions

func InjectCorrelationID

func InjectCorrelationID(h http.Handler) http.Handler

func NoContext

func NoContext() *logrus.Logger

NoContext provides logrus.StandardLogger()

func WithContext

func WithContext(ctx context.Context) *logrus.Entry

WithContext provides a *logrus.Entry with the proper "correlation-id" field.

"[MISSING]" will be used when ctx has no value for KeyCorrelationID

func WithError

func WithError(ctx context.Context, err error) *logrus.Entry

WithError decorates logrus.WithError with the proper "correlation-id"

func WithField

func WithField(ctx context.Context, key string, value interface{}) *logrus.Entry

WithField decorates logrus.WithField with the proper "correlation-id"

func WithFields

func WithFields(ctx context.Context, f Fields) *logrus.Entry

WithFields decorates logrus.WithFields with the proper "correlation-id"

func WrapEntry

func WrapEntry(ctx context.Context, e *logrus.Entry) *logrus.Entry

WrapEntry adds the proper "correlation-id" field to the provided *logrus.Entry

Types

type Fields

type Fields map[string]interface{}

Fields type, an helper to avoid importing logrus.Fields

Jump to

Keyboard shortcuts

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