logger

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package logger provides a convenient interface to use to log.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger is a concrete logger using logr underneath.

func FromContext

func FromContext(ctx context.Context) *Logger

FromContext retrieves the logr implementation from Context and uses it as underlying logger.

func NewLogger

func NewLogger(log logr.Logger) *Logger

NewLogger creates a logger with a passed in logr.Logger implementation directly.

func (*Logger) Debug

func (c *Logger) Debug(msg string, keysAndValues ...any)

Debug logs a message at the debug level.

func (*Logger) Error

func (c *Logger) Error(err error, msg string, keysAndValues ...any)

Error logs a message at the error level.

func (*Logger) GetLogger

func (c *Logger) GetLogger() logr.Logger

GetLogger returns the underlying logr.Logger.

func (*Logger) Info

func (c *Logger) Info(msg string, keysAndValues ...any)

Info logs a message at the info level.

func (*Logger) Trace

func (c *Logger) Trace(msg string, keysAndValues ...any)

Trace logs a message at the trace level.

func (*Logger) Warn

func (c *Logger) Warn(msg string, keysAndValues ...any)

Warn logs a message at the warn level.

func (*Logger) WithName

func (c *Logger) WithName(name string) *Logger

WithName adds a new element to the logger's name.

func (*Logger) WithValues

func (c *Logger) WithValues(keysAndValues ...any) *Logger

WithValues adds some key-value pairs of context to a logger.

type Wrapper

type Wrapper interface {
	Info(msg string, keysAndValues ...any)
	Debug(msg string, keysAndValues ...any)
	Warn(msg string, keysAndValues ...any)
	Trace(msg string, keysAndValues ...any)
	Error(err error, msg string, keysAndValues ...any)
	WithValues(keysAndValues ...any) *Logger
	WithName(name string) *Logger
	GetLogger() logr.Logger
}

Wrapper defines a convenient interface to use to log things.

Jump to

Keyboard shortcuts

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