testlogger

package
v1.18.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestLogger

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

TestLogger wraps testing.NTB to add optional debug logging, without exposing the ability to error or fatally terminate the test.

func New

func New(t testing.NTB, debugEnabled bool) *TestLogger

New constructs a new TestLogger

func (*TestLogger) Debug

func (tl *TestLogger) Debug(args ...interface{})

Debug only prints the log message if debug is enabled. Use for verbose logs that can be enabled by developers, but won't show in CI.

func (*TestLogger) Debugf

func (tl *TestLogger) Debugf(format string, args ...interface{})

Debugf only prints the log message, with Sprintf-like formatting, if debug is enabled. Use for verbose logs that can be enabled by developers, but won't show in CI.

func (*TestLogger) Info

func (tl *TestLogger) Info(args ...interface{})

Info prints the message to the test log.

func (*TestLogger) Infof

func (tl *TestLogger) Infof(format string, args ...interface{})

Infof prints the message to the test log, with Sprintf-like formatting.

func (*TestLogger) IsDebugEnabled

func (tl *TestLogger) IsDebugEnabled() bool

IsDebugEnabled returns true if debug is enabled for this test

func (*TestLogger) SetNTBForTest added in v1.16.0

func (tl *TestLogger) SetNTBForTest(t testing.NTB)

SetNTBForTest sets the loggers NTB for the scope of a test. This ensures that for shared test environments, the actual test's logger is used for the scope of the test. This ensures proper interleaving of logs when running tests in parallel. Reset to the original logger after the test for post-test logging.

Jump to

Keyboard shortcuts

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