testlog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: MIT Imports: 4 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 is used to capture logs during the execution of a test. It writes the logs to a byte buffer which can be dumped and inspected. It also tracks a call count of the total number of times the logger has been called. Note that this logger is not meant to be used in production. It is meant only for tests.

func New

func New() *TestLogger

NewTestLog generates a new TestLogger

func (*TestLogger) Bytes

func (t *TestLogger) Bytes() []byte

Bytes returns all bytes of the log buffer

func (*TestLogger) CallCount

func (t *TestLogger) CallCount() int

CallCount returns the number of times this logger was called

func (*TestLogger) Debug

func (t *TestLogger) Debug(msg ...interface{})

Debug log message

func (*TestLogger) Debugf

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

Debugf log message with formatting

func (*TestLogger) Error

func (t *TestLogger) Error(msg ...interface{})

Error log message

func (*TestLogger) Errorf

func (t *TestLogger) Errorf(format string, args ...interface{})

Errorf log message with formatting

func (*TestLogger) Info

func (t *TestLogger) Info(msg ...interface{})

Info log message

func (*TestLogger) Infof

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

Infof log message with formatting

func (*TestLogger) Reset

func (t *TestLogger) Reset()

Reset the log buffer and call count

func (*TestLogger) Warn

func (t *TestLogger) Warn(msg ...interface{})

Warn log message

func (*TestLogger) Warnf

func (t *TestLogger) Warnf(format string, args ...interface{})

Warnf log message with formatting

func (*TestLogger) WithFields

func (t *TestLogger) WithFields(fields log.Fields) log.Logger

WithFields will return a new logger based on the original logger with the additional supplied fields

Jump to

Keyboard shortcuts

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