serrors

package
v0.0.0-...-4250f4c Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 7 Imported by: 49

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(logger logr.Logger) logr.Logger

NewLogger creates a new log logr.Logger using the serrors.Logger

func UnwrapValues

func UnwrapValues(err error) (res []any)

UnwrapValues returns a combined set of keys and values from every wrapped error

func Wrap

func Wrap(err error, keysAndValues ...any) error

Wrap wraps and existing error with additional structured keys and values

Types

type Error

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

Error is a structured error that stores structured errors and values alongside the error

func (*Error) Error

func (e *Error) Error() string

Error returns the string representation of the error

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the unwrapped error

func (*Error) WithValues

func (e *Error) WithValues(keysAndValues ...any) *Error

WithValues injects additional structured keys and values into the error

type Logger

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

Logger is a structured error logger that can be used as a wrapper for other logr.Loggers It unwraps the values for structured errors and calls WithValues() for them

func (*Logger) Enabled

func (l *Logger) Enabled(level int) bool

func (*Logger) Error

func (l *Logger) Error(err error, msg string, keysAndValues ...interface{})

func (*Logger) Info

func (l *Logger) Info(level int, msg string, keysAndValues ...interface{})

func (*Logger) Init

func (l *Logger) Init(ri logr.RuntimeInfo)

func (*Logger) WithName

func (l *Logger) WithName(name string) logr.LogSink

func (*Logger) WithValues

func (l *Logger) WithValues(keysAndValues ...interface{}) logr.LogSink

Jump to

Keyboard shortcuts

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