log

package
v2.13.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TenantLoggerKey   = "tenantID"
	StreamIDLoggerKey = "streamID"
)

Variables

This section is empty.

Functions

func AddFieldsFromCtx

func AddFieldsFromCtx(
	logger logr.Logger,
	ctx context.Context,
	extensions context.Context,
) logr.Logger

AddFieldsFromCtx will check if provided context contain tracing span and if the span is currently recording. If so, it will call spanLogValuesProcessor function if it's also present in the context. If not it will add trace_id and span_id to logged values. It will also add the tenant id to the logged values.

func NewLogger

func NewLogger(level LogLevel) logr.Logger

func NewLoggerTo

func NewLoggerTo(destWriter io.Writer, level LogLevel) logr.Logger

func NewLoggerWithGlobalLevel added in v2.13.0

func NewLoggerWithGlobalLevel() logr.Logger

NewLoggerWithGlobalLevel creates a logger that uses the global atomic level. The log level can be changed dynamically using SetGlobalLogLevel without replacing the logger instance. This is useful for early initialization (e.g., in init() functions) where the final log level is not yet known.

func NewLoggerWithRotation

func NewLoggerWithRotation(level LogLevel, outputPath string, maxSize int, maxBackups int, maxAge int) logr.Logger

func SetGlobalLogLevel added in v2.13.0

func SetGlobalLogLevel(level LogLevel)

SetGlobalLogLevel updates the global atomic log level used by loggers created with NewLoggerWithGlobalLevel. This allows changing the log level of all such loggers without replacing the logger instances.

Types

type LogLevel

type LogLevel int
const (
	OffLevel LogLevel = iota
	InfoLevel
	DebugLevel
)

func ParseLogLevel

func ParseLogLevel(text string) (LogLevel, error)

func (LogLevel) String

func (l LogLevel) String() string

Jump to

Keyboard shortcuts

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