loggotest

package
v0.0.0-...-6573248 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Between

func Between(start, end time.Time) gc.Checker

func CheckLastMessage

func CheckLastMessage(c *gc.C, writer *Writer, expected string)

Types

type Formatter

type Formatter struct {
	Writer
	// contains filtered or unexported fields
}

Formatter is a useful Writer for testing purposes. Each component of the logging message is stored in the Log array.

func NewFormatter

func NewFormatter(format func(level loggo.Level, module, filename string, line int, timestamp time.Time, message string) string) *Formatter

NewFormatter returns a new Formatter that wraps the given format func. If the func is nil then Format() will return the message.

func (*Formatter) Format

func (f *Formatter) Format(level loggo.Level, module, filename string, line int, timestamp time.Time, message string) string

Format saves the params as members in the TestLogValues struct appended to the Log array.

type LogValues

type LogValues struct {
	Level     loggo.Level
	Module    string
	Filename  string
	Line      int
	Timestamp time.Time
	Message   string
}

LogValues represents a single logging call.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is a useful loggo.Writer for testing purposes. Each component of the logging message is stored in the Log array.

func TraceLogger

func TraceLogger() (loggo.Logger, *Writer)

TraceLogger returns the named logger. It also sets the logger's writer and returns it.

func (*Writer) Clear

func (writer *Writer) Clear()

Clear removes any saved log messages.

func (*Writer) Log

func (writer *Writer) Log() []LogValues

Log returns a copy of the current logged values.

func (*Writer) Write

func (writer *Writer) Write(level loggo.Level, module, filename string, line int, timestamp time.Time, message string)

Write saves the params as members in the LogValues struct appended to the Log array.

Jump to

Keyboard shortcuts

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