ctxlog

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 3 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.Helper

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.Helper) 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
}

func NewFields

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

func (*Fields) Merge

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

func (*Fields) Set

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

func (*Fields) Values

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

Jump to

Keyboard shortcuts

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