logrfake

package
v0.0.0-...-a53be28 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFakeLogger

func NewFakeLogger(t *testing.T) logr.Logger

Types

type FakeLogger

type FakeLogger struct {
	Level int
	Name  string
	KV    []interface{}
	T     *testing.T
}

func (FakeLogger) Enabled

func (r FakeLogger) Enabled() bool

Enabled tests whether this Logger is enabled. For example, commandline flags might be used to set the logging verbosity and disable some info logs.

func (FakeLogger) Error

func (r FakeLogger) Error(err error, msg string, keysAndValues ...interface{})

Error logs an error, with the given message and key/value pairs as context. It functions similarly to calling Info with the "error" named value, but may have unique behavior, and should be preferred for logging errors (see the package documentations for more information).

The msg field should be used to add context to any underlying error, while the err field should be used to attach the actual error that triggered this log line, if present.

func (FakeLogger) Info

func (r FakeLogger) Info(msg string, keysAndValues ...interface{})

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

The msg argument should be used to add some constant description to the log line. The key/value pairs can then be used to add additional variable information. The key/value pairs should alternate string keys and arbitrary values.

func (FakeLogger) V

func (r FakeLogger) V(level int) logr.Logger

V returns an Logger value for a specific verbosity level, relative to this Logger. In other words, V values are additive. V higher verbosity level means a log message is less important. It's illegal to pass a log level less than zero.

func (FakeLogger) WithName

func (r FakeLogger) WithName(name string) logr.Logger

WithName adds a new element to the logger's name. Successive calls with WithName continue to append suffixes to the logger's name. It's strongly recommended that name segments contain only letters, digits, and hyphens (see the package documentation for more information).

func (FakeLogger) WithValues

func (r FakeLogger) WithValues(keysAndValues ...interface{}) logr.Logger

WithValues adds some key-value pairs of context to a logger. See Info for documentation on how key/value pairs work.

Jump to

Keyboard shortcuts

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