logctx

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMapToContext

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

AddMapToContext adds the map of key/values to the log context.

func AddStrToContext

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

AddStrToContext adds the key/value to the log context.

func AddToContext

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

AddToContext adds the key/value to the log context.

func GetID

func GetID(ctx context.Context) string

GetID returns the request ID logged to the context, otherwise 0.

func NewContextFrom

func NewContextFrom(ctx context.Context) context.Context

NewContextFrom clones the current context. Used to branch execution (go routines).

func NewSubLoggerContext

func NewSubLoggerContext(log zerolog.Logger) context.Context

NewSubLoggerContext creates a new logger with an empty context.

func SetID

func SetID(ctx context.Context, id string) context.Context

SetID sets the request ID logged to the context.

Types

type ContextKey

type ContextKey string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳