test

package
v0.5.0-zeta Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 3 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 {
	T *testing.T
	// contains filtered or unexported fields
}

Logger is a simple, yet thread-safe, logger intended for use in unit tests.

func NewLogger

func NewLogger(t *testing.T) *Logger

NewLogger create a Logger that outputs data using given testing.T instance.

func (*Logger) Debug

func (t *Logger) Debug(msg string, keyvals ...interface{})

Debug prints a debug message.

func (*Logger) Error

func (t *Logger) Error(msg string, keyvals ...interface{})

Error prints an error message.

func (*Logger) Info

func (t *Logger) Info(msg string, keyvals ...interface{})

Info prints an info message.

type MockLogger

type MockLogger struct {
	DebugLines, InfoLines, ErrLines []string
}

MockLogger is a fake logger that accumulates all the inputs.

It can be used in tests to ensure that certain messages was logged with correct severity.

func (*MockLogger) Debug

func (t *MockLogger) Debug(msg string, keyvals ...interface{})

Debug saves a debug message.

func (*MockLogger) Error

func (t *MockLogger) Error(msg string, keyvals ...interface{})

Error saves an error message.

func (*MockLogger) Info

func (t *MockLogger) Info(msg string, keyvals ...interface{})

Info saves an info message.

Jump to

Keyboard shortcuts

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