loggo: github.com/howbazaar/loggo/loggotest Index | Files

package loggotest

import "github.com/howbazaar/loggo/loggotest"

Index

Package Files

checkers.go formatter.go logger.go writer.go

func Between Uses

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

func CheckLastMessage Uses

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

func TraceLogger Uses

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

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

type Formatter Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 (*Writer) Clear Uses

func (writer *Writer) Clear()

Clear removes any saved log messages.

func (*Writer) Log Uses

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

Log returns a copy of the current logged values.

func (*Writer) Write Uses

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.

Package loggotest imports 6 packages (graph). Updated 2016-08-04. Refresh now. Tools for package owners.