log

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const Noop = noop(0)

Noop logger doesn't log anything.

Variables

This section is empty.

Functions

func CtxWithValues

func CtxWithValues(parent context.Context, kv Kv) context.Context

CtxWithValues returns a copy of parent in which the key values passed have been stored ready to be used using log.Logger.

Types

type Kv

type Kv = map[string]interface{}

Kv is a helper type for structured logging fields usage.

func ValuesFromCtx

func ValuesFromCtx(ctx context.Context) Kv

ValuesFromCtx gets the log Key values from a context.

type Logger

type Logger interface {
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Debugf(format string, args ...interface{})
	WithValues(values map[string]interface{}) Logger
	WithCtxValues(ctx context.Context) Logger
	SetValuesOnCtx(parent context.Context, values map[string]interface{}) context.Context
}

Logger is the interface that the loggers used by the library will use.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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