record

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

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

Listener defines a listener for log entries.

func NewListener

func NewListener(logger *Logger) *Listener

NewListener returns a new listener with the specified logger.

func (*Listener) GetEntries

func (li *Listener) GetEntries() []LogEntry

GetEntries returns a copy of the list of log entries.

func (*Listener) Listen

func (li *Listener) Listen() func()

Listen adds this listener to its logger.

type LogEntry

type LogEntry struct {
	// Prefix of the log line, composed of the hierarchy of log.WithName values.
	Prefix string

	// LogFunc of the log entry, e.g. "Info", "Error"
	LogFunc string

	// Level of the LogEntry.
	Level int

	// Values of the log line, composed of the concatenation of log.WithValues and KeyValue pairs passed to log.Info.
	Values []interface{}
}

LogEntry defines the information that can be used for composing a log line.

type Logger

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

Logger defines a test-friendly logr.Logger.

func NewLogger

func NewLogger(options ...Option) *Logger

NewLogger returns a new instance of the clusterctl.

func (*Logger) Enabled

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

Enabled is always enabled.

func (*Logger) Error

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

Error logs an error message with the given key/value pairs as context.

func (*Logger) Info

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

Info logs a non-error message with the given key/value pairs as context.

func (*Logger) Init added in v1.2.0

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

Init initializes the logger from runtime information.

func (*Logger) V

func (l *Logger) V(level int) logr.LogSink

V returns an Logger value for a specific verbosity level.

func (*Logger) WithName

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

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

func (*Logger) WithValues

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

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

type Option

type Option func(*Logger)

Option is a configuration option supplied to NewLogger.

func WithThreshold

func WithThreshold(threshold *int) Option

WithThreshold implements a New Option that allows to set the threshold level for a new logger. The logger will write only log messages with a level/V(x) equal or higher to the threshold.

func WithWriter

func WithWriter(wr io.Writer) Option

WithWriter configures the logger to write to the io.Writer.

Jump to

Keyboard shortcuts

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