logtest

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: Unlicense Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoggerMock

type LoggerMock struct {
	// DebugFunc mocks the Debug method.
	DebugFunc func(msg string)

	// ErrorFunc mocks the Error method.
	ErrorFunc func(msg string)

	// InfoFunc mocks the Info method.
	InfoFunc func(msg string)

	// WarnFunc mocks the Warn method.
	WarnFunc func(msg string)
	// contains filtered or unexported fields
}

LoggerMock is a mock implementation of Logger.

func TestSomethingThatUsesLogger(t *testing.T) {

	// make and configure a mocked Logger
	mockedLogger := &LoggerMock{
		DebugFunc: func(msg string)  {
			panic("mock out the Debug method")
		},
		ErrorFunc: func(msg string)  {
			panic("mock out the Error method")
		},
		InfoFunc: func(msg string)  {
			panic("mock out the Info method")
		},
		WarnFunc: func(msg string)  {
			panic("mock out the Warn method")
		},
	}

	// use mockedLogger in code that requires Logger
	// and then make assertions.

}

func NewLoggerMock

func NewLoggerMock() *LoggerMock

func (*LoggerMock) Debug

func (mock *LoggerMock) Debug(msg string)

Debug calls DebugFunc.

func (*LoggerMock) DebugCalls

func (mock *LoggerMock) DebugCalls() []struct {
	Msg string
}

DebugCalls gets all the calls that were made to Debug. Check the length with:

len(mockedLogger.DebugCalls())

func (*LoggerMock) Error

func (mock *LoggerMock) Error(msg string)

Error calls ErrorFunc.

func (*LoggerMock) ErrorCalls

func (mock *LoggerMock) ErrorCalls() []struct {
	Msg string
}

ErrorCalls gets all the calls that were made to Error. Check the length with:

len(mockedLogger.ErrorCalls())

func (*LoggerMock) Info

func (mock *LoggerMock) Info(msg string)

Info calls InfoFunc.

func (*LoggerMock) InfoCalls

func (mock *LoggerMock) InfoCalls() []struct {
	Msg string
}

InfoCalls gets all the calls that were made to Info. Check the length with:

len(mockedLogger.InfoCalls())

func (*LoggerMock) Warn

func (mock *LoggerMock) Warn(msg string)

Warn calls WarnFunc.

func (*LoggerMock) WarnCalls

func (mock *LoggerMock) WarnCalls() []struct {
	Msg string
}

WarnCalls gets all the calls that were made to Warn. Check the length with:

len(mockedLogger.WarnCalls())

Jump to

Keyboard shortcuts

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