log

package
v0.0.0-...-f87def4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2016 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	Logger
	Fielder
	Reader
	Created() time.Time
}

type Field

type Field struct {
	Key   string
	Value interface{}
}

type Fielder

type Fielder interface {
	Fields() []Field
}

type Formatter

type Formatter interface {
	Format(Entry) ([]byte, error)
}

func DefaultNullFormatter

func DefaultNullFormatter() Formatter

func DefaultTextFormatter

func DefaultTextFormatter() Formatter

type Hook

type Hook interface {
	On() []Level
	Fire(Entry) error
}

type Hooks

type Hooks interface {
	AddHook(Hook)
	Fire(Level, Entry) error
}

type JsonFormatter

type JsonFormatter struct {
	TimestampFormat string
}

func (*JsonFormatter) Format

func (j *JsonFormatter) Format(e Entry) ([]byte, error)

type Level

type Level int
const (
	LUnrecognized Level = iota
	LPanic
	LFatal
	LError
	LWarn
	LInfo
	LDebug
)

func StringToLevel

func StringToLevel(lv string) Level

func (Level) Color

func (lv Level) Color() string

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	io.Writer
	StdLogger
	Log(Level, Entry)
	Mutex
	Level() Level
	Formatter
	Hooks
}

func New

func New(w io.Writer, l Level, f Formatter) Logger

type Mutex

type Mutex interface {
	Lock()
	Unlock()
}

type NullFormatter

type NullFormatter struct{}

func (*NullFormatter) Format

func (n *NullFormatter) Format(e Entry) ([]byte, error)

type Reader

type Reader interface {
	Read() (*bytes.Buffer, error)
}

type StdLogger

type StdLogger interface {
	Fatal(...interface{})
	Fatalf(string, ...interface{})
	Fatalln(...interface{})
	Panic(...interface{})
	Panicf(string, ...interface{})
	Panicln(...interface{})
	Print(...interface{})
	Printf(string, ...interface{})
	Println(...interface{})
}

type TextFormatter

type TextFormatter struct {
	Color           bool
	TimestampFormat string
	Sort            bool
}

func (*TextFormatter) Format

func (t *TextFormatter) Format(e Entry) ([]byte, error)

Jump to

Keyboard shortcuts

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