logtest

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logtest is the dummy logger for testing Landns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DummyLogger

type DummyLogger []Entry

DummyLogger is dummy logger for logging test.

func (*DummyLogger) Debug

func (l *DummyLogger) Debug(message string, fields logger.Fields)

Debug is writer to DebugLevel log.

func (*DummyLogger) Error

func (l *DummyLogger) Error(message string, fields logger.Fields)

Error is writer to ErrorLevel log.

func (*DummyLogger) Fatal

func (l *DummyLogger) Fatal(message string, fields logger.Fields)

Fatal is writer to FatalLevel log.

func (*DummyLogger) GetLevel

func (l *DummyLogger) GetLevel() logger.Level

GetLevel is always returns logger.DebugLevel.

func (*DummyLogger) Info

func (l *DummyLogger) Info(message string, fields logger.Fields)

Info is writer to InfoLevel log.

func (*DummyLogger) String

func (l *DummyLogger) String() string

String is converter to human readable string.

func (*DummyLogger) Test

func (l *DummyLogger) Test(expect []Entry) error

Test is check last log entries.

func (*DummyLogger) TestAll

func (l *DummyLogger) TestAll(expect []Entry) error

TestAll is check all log entries.

func (*DummyLogger) Warn

func (l *DummyLogger) Warn(message string, fields logger.Fields)

Warn is writer to WarnLevel log.

type Entry

type Entry struct {
	Level   logger.Level
	Message string
	Fields  logger.Fields
}

Entry is one entry of DummyLogger.

func (Entry) String

func (le Entry) String() string

String is converter to human readable string.

type LogTest

type LogTest struct {
	Logger *DummyLogger
	// contains filtered or unexported fields
}

LogTest is the helper to log testing.

func Start

func Start() LogTest

Start is starter of LogTest.

func (LogTest) Close

func (lt LogTest) Close() error

Close is restore logger state to before call Start.

func (LogTest) Test

func (lt LogTest) Test(expect []Entry) error

Test is check last log entries.

func (LogTest) TestAll

func (lt LogTest) TestAll(expect []Entry) error

TestAll is check all log entries.

Jump to

Keyboard shortcuts

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