logger

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2017 License: GPL-2.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear clears the log

func Log

func Log(err error)

Log logs a new error to the history

Types

type Entry

type Entry struct {
	Type    string `json:"type"`
	Task    string `json:"task"`
	Event   string `json:"event"`
	Message string `json:"message"`
	Time    int64  `json:"time"`
}

Entry is a log entry in the log

func Convert

func Convert(err error) *Entry

Convert converts an error intro a log entry

func NewError

func NewError(err string) *Entry

NewError returns a new entry for logging

func NewSuccess

func NewSuccess(err string) *Entry

NewSuccess returns a new successful log entry

func (*Entry) Error

func (e *Entry) Error() string

func (*Entry) Log

func (e *Entry) Log()

Log appends the entry to the log history

func (*Entry) SetEvent

func (e *Entry) SetEvent(t types.Identifiable) *Entry

SetEvent bind an event to the given error

func (*Entry) SetTask

func (e *Entry) SetTask(t types.Identifiable) *Entry

SetTask binds a task to the given error

type History

type History []*Entry

History is a slice of entries

func Get

func Get(time int64) History

Get retrieved log newer than a specified time

func (History) Len

func (l History) Len() int

func (History) Less

func (l History) Less(i, j int) bool

func (History) Swap

func (l History) Swap(i, j int)

Jump to

Keyboard shortcuts

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