log_context

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const ArrayLimit = 100
View Source
const CtxRequestId = "reqId"
View Source
const CtxTraceId = "traId"
View Source
const GinCtxRequestIdKeyStr = "x-req-id"
View Source
const GinCtxTraceIdKeyStr = "x-tra-id"
View Source
const LogContextKeyStr = ctxKey("LCK")
View Source
const UnnamedKeyStr = "unnamed"

Variables

This section is empty.

Functions

func CopyLogContext

func CopyLogContext(ctx context.Context) context.Context

func GetLogContext

func GetLogContext(ctx context.Context) []any

func GetLogContextValue

func GetLogContextValue(ctx context.Context, key string) (value any, ok bool)

func GetLogContextValueAsString

func GetLogContextValueAsString(ctx context.Context, key string) (value string, ok bool)

func GetLogTrackContext

func GetLogTrackContext(ctx context.Context) (reqId string, traId string)

func NewId

func NewId() string

func NewTrackLogContext

func NewTrackLogContext(ctx context.Context) context.Context

func SetLogContextKeyStringValueIfNotEmpty

func SetLogContextKeyStringValueIfNotEmpty(ctx context.Context, key string, value string) context.Context

func SetLogContextKeyValue

func SetLogContextKeyValue(ctx context.Context, key string, value any) context.Context

func SetTrackLogContext

func SetTrackLogContext(ctx context.Context, reqId string, traId string) context.Context

Types

type LogValues

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

func (*LogValues) All

func (v *LogValues) All() []any

func (*LogValues) Copy

func (v *LogValues) Copy() *LogValues

func (*LogValues) Get

func (v *LogValues) Get(key string) (value any, ok bool)

func (*LogValues) GetStr

func (v *LogValues) GetStr(key string) (value string, ok bool)

func (*LogValues) Set

func (v *LogValues) Set(key string, value any)

Jump to

Keyboard shortcuts

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