ctxlog

package
v0.0.0-...-379887d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

ctxlog provides context-aware logging. Loosely based on https://github.com/containerd/containerd/blob/master/log/context.go

Index

Constants

This section is empty.

Variables

View Source
var (
	// L is an alias for Logger.
	L = Logger
)

Functions

func Logger

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

Logger retrieves the current logger from the context. If no logger is available, the default logger is returned.

func WithField

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

WithField returns a new context with the provided field set in the existing logger.

func WithFields

func WithFields(ctx context.Context, fields logrus.Fields) context.Context

WithFields returns a new context with the provided fields set in the existing logger.

func WithLogger

func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context

WithLogger returns a new context with the provided logger. Use in combination with logger.WithField(s) for great effect.

Types

type Fields

type Fields = logrus.Fields

Jump to

Keyboard shortcuts

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