testutil

package
v0.0.0-...-dc23390 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package testutil provide test utilities for testing common packages. Go doesn't support importing from _test files, so common test utilities have to be exported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapturedLogEntry

type CapturedLogEntry struct {
	Message   string
	Arguments []interface{}
}

CapturedLogEntry represents a captured log entry (for test purposes only).

type LogCapturer

type LogCapturer struct {
	*Logger
	DebugCaptures []*CapturedLogEntry
	InfoCaptures  []*CapturedLogEntry
	WarnCaptures  []*CapturedLogEntry
	ErrorCaptures []*CapturedLogEntry
}

LogCapturer is a logger that silently captures logs (for test purposes only).

func NewLogCapturer

func NewLogCapturer(inDebugMode bool) *LogCapturer

NewLogCapturer creates a logger that silently captures logs (for test purposes only).

func (*LogCapturer) Debug

func (logger *LogCapturer) Debug(message string, args ...interface{})

Debug captures a debug message.

func (*LogCapturer) Error

func (logger *LogCapturer) Error(message string, args ...interface{})

Error captures an error message.

func (*LogCapturer) Info

func (logger *LogCapturer) Info(message string, args ...interface{})

Info captures a informational message.

func (*LogCapturer) Warn

func (logger *LogCapturer) Warn(message string, args ...interface{})

Warn captures a warning message.

type Logger

type Logger struct {
	InDebugMode bool
}

Logger is a logger for test purposes only.

func (*Logger) Debug

func (logger *Logger) Debug(message string, args ...interface{})

Debug logs a debug message.

func (*Logger) Error

func (*Logger) Error(message string, args ...interface{})

Error logs an error message.

func (*Logger) Info

func (*Logger) Info(message string, args ...interface{})

Info logs a informational message.

func (*Logger) IsDebugEnabled

func (logger *Logger) IsDebugEnabled() bool

IsDebugEnabled checks whether or not debug logging is enabled.

func (*Logger) Sync

func (*Logger) Sync() error

Sync flushes the logger.

func (*Logger) Warn

func (*Logger) Warn(message string, args ...interface{})

Warn logs a warning message.

Jump to

Keyboard shortcuts

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