testlogger

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 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 Logger

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

func New

func New(logger TestLogger) *Logger

New will create a Logger from a TestLogger. The Logger that is created satisfies the log.DebugLogger interface and thus may be used widely. It serves as an adaptor between the testing.T type from the standard library and library code that expects a generic logging type. Trailing newlines are removed before calling the TestLogger methods.

func (*Logger) Debug

func (l *Logger) Debug(level uint8, v ...interface{})

Debug will call the Log method of the underlying TestLogger, regardless of the debug level.

func (*Logger) Debugf

func (l *Logger) Debugf(level uint8, format string, v ...interface{})

Debugf is similar to Debug, with formatting support.

func (*Logger) Debugln

func (l *Logger) Debugln(level uint8, v ...interface{})

Debugln is similar to Debug.

func (*Logger) Fatal

func (l *Logger) Fatal(v ...interface{})

Fatal will call the Fatal method of the underlying TestLogger.

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

Fatalf is similar to Fatal, with formatting support.

func (*Logger) Fatalln

func (l *Logger) Fatalln(v ...interface{})

Fatalln is similar to Fatal.

func (*Logger) Panic

func (l *Logger) Panic(v ...interface{})

Panic will call the Fatal method of the underlying TestLogger and will then call panic.

func (*Logger) Panicf

func (l *Logger) Panicf(format string, v ...interface{})

Panicf is similar to Panic, with formatting support.

func (*Logger) Panicln

func (l *Logger) Panicln(v ...interface{})

Panicln is similar to Panic.

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

Print will call the Log method of the underlying TestLogger.

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...interface{})

Printf is similar to Print, with formatting support.

func (*Logger) Println

func (l *Logger) Println(v ...interface{})

Println is similar to Print.

type TestLogger

type TestLogger interface {
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	Log(v ...interface{})
	Logf(format string, v ...interface{})
}

TestLogger defines an interface for a type that can be used for logging by tests. The testing.T type from the standard library satisfies this interface.

Jump to

Keyboard shortcuts

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