ctxlog

package
v0.0.0-...-9d47b84 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFields

func AddFields(ctx context.Context, fields map[string]interface{})

AddFields adds logger fields to the logger.

func Debug

func Debug(ctx context.Context, msg string, fields map[string]interface{})

Debug is equivalent to calling Debug on the logger.Logger in the context. It is a no-op if the context does not contain a logger.Logger.

func Error

func Error(ctx context.Context, msg string, fields map[string]interface{})

Error is equivalent to calling Error on the logger.Logger in the context. It is a no-op if the context does not contain a logger.Logger.

func Extract

func Extract(ctx context.Context) logger.Logger

Extract takes the call-scoped Logger from grpc_logger middleware. It always returns a Logger that has all the grpc_ctxtags updated.

func Info

func Info(ctx context.Context, msg string, fields map[string]interface{})

Info is equivalent to calling Info on the logger.Logger in the context. It is a no-op if the context does not contain a logger.Logger.

func TagsToFields

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

TagsToFields transforms the Tags on the supplied context into logger fields.

func ToContext

func ToContext(ctx context.Context, logger logger.Logger) context.Context

ToContext adds the logger.Logger to the context for extraction later. Returning the new context that has been created.

func Warn

func Warn(ctx context.Context, msg string, fields map[string]interface{})

Warn is equivalent to calling Warn on the logger.Logger in the context. It is a no-op if the context does not contain a logger.Logger.

Types

type Fields

type Fields struct {
	// contains filtered or unexported fields
}

Fields fields

func NewFields

func NewFields(key string, value interface{}) *Fields

NewFields make a new fields

func (*Fields) Merge

func (e *Fields) Merge(f *Fields)

Merge merge fields

func (*Fields) Set

func (e *Fields) Set(key string, value interface{})

Set set field

func (*Fields) Values

func (e *Fields) Values() map[string]interface{}

Values return value

Jump to

Keyboard shortcuts

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