testing

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestLogger added in v1.0.0

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

NewTestLogger returns a logr.Logger that prints through a testing.T object. Info logs are only enabled at V(0).

func NewTestLoggerWithOptions added in v1.1.0

func NewTestLoggerWithOptions(t *testing.T, opts Options) logr.Logger

NewTestLoggerWithOptions returns a logr.Logger that prints through a testing.T object. In contrast to the simpler NewTestLogger, output formatting can be configured.

Types

type Options added in v1.1.0

type Options struct {
	// LogTimestamp tells the logger to add a "ts" key to log
	// lines. This has some overhead, so some users might not want
	// it.
	LogTimestamp bool

	// Verbosity tells the logger which V logs to be write.
	// Higher values enable more logs.
	Verbosity int
}

Options carries parameters which influence the way logs are generated.

type Underlier added in v1.1.0

type Underlier interface {
	GetUnderlying() *testing.T
}

Underlier exposes access to the underlying testing.T instance. Since callers only have a logr.Logger, they have to know which implementation is in use, so this interface is less of an abstraction and more of a way to test type conversion.

Jump to

Keyboard shortcuts

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