Documentation
¶
Index ¶
- func AddBytes(ctx zerolog.Context, key string, value []byte, maxSize uint32) zerolog.Context
- func AddBytesToContext(ctx context.Context, key string, value []byte, maxSize uint32)
- func AddMapToContext(ctx context.Context, fields map[string]any)
- func AddStrToContext(ctx context.Context, key, value string)
- func AddToContext(ctx context.Context, key string, value any)
- func GetID(ctx context.Context) string
- func NewContextFrom(ctx context.Context) context.Context
- func NewSubLoggerContext(ctx context.Context, log zerolog.Logger) context.Context
- func SetID(ctx context.Context, id string) context.Context
- type ContextKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddBytes ¶ added in v0.5.2
AddBytes adds the key/value (truncated by maxSize) to the log context.
func AddBytesToContext ¶ added in v0.5.2
AddBytesToContext adds the key/value to the log context.
func AddMapToContext ¶
AddMapToContext adds the map of key/values to the log context.
func AddStrToContext ¶
AddStrToContext adds the key/value to the log context.
func AddToContext ¶
AddToContext adds the key/value to the log context.
func NewContextFrom ¶
NewContextFrom returns a child context without cancel and a sub-logger attached. If no logger is associated with the given ctx as the parent logger DefaultContextLogger is used if not nil, otherwise a disabled logger is used.
func NewSubLoggerContext ¶
NewSubLoggerContext creates a new logger with an empty context.
Types ¶
type ContextKey ¶
type ContextKey string
Click to show internal directories.
Click to hide internal directories.