testinglogger

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package testinglogger contains an implementation of the logr interface which is logging through a function like testing.TB.Log function. Serialization of the structured log parameters is done in the format used also by klog/klogr.

The code had to be copied because:

  • klog/klogr always prints to the global klog
  • go-logr/stdr (a very similar code) allows redirecting output, but its own functions then appear as source code location because they are not calling t.Helper()
  • we want to output *all* messages regardless of their log level; "go test" will suppress output by default unless a test failed, in which case we want all output that we can get

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(l Logger) logr.Logger

New constructs a new logger for the given test interface.

Types

type Logger

type Logger interface {
	Helper()
	Log(args ...interface{})
}

Logger is the relevant subset of testing.TB.

Jump to

Keyboard shortcuts

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