ctxlog

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CtxKeyLog = CtxKey("log")
)

Variables

This section is empty.

Functions

func LogcFromCtx

func LogcFromCtx(ctx context.Context, opts ...LogOption) log.Logger

func Logger

func Logger(ctx context.Context, opts ...LogOption) log.Logger

Logger get logger from the context. By default, it uses "log" key. use WithLogName("<custom name>") to set custom key If logger not found dummyLogger is returned

func LogrFromCtx

func LogrFromCtx(ctx context.Context) logr.Logger

func WithLogc

func WithLogc(ctx context.Context, lg log.Logger, opts ...LogOption) context.Context

WithLogc add logger object to the context key defaults to the "log" use WithLogName("<custom name>") to set custom key

func WithLogger

func WithLogger(ctx context.Context, lg log.Logger, opts ...LogOption) context.Context

WithLogger add logger object to the context key defaults to the "log" use WithLogName("<custom name>") to set custom key

Types

type CtxKey

type CtxKey string

type LogOption

type LogOption func(*options) error

func WithLogName

func WithLogName(val string) LogOption

WithLogName set custom name of the log object

Jump to

Keyboard shortcuts

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