logging

package
v0.0.0-...-3015c2b Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShortTimestampFormat = "15:04:05"
	LongTimestampFormat  = "2006-01-02 15:04:05.000"
)

Variables

View Source
var NilColorPicker = newColorPicker(false)
View Source
var NilLogger = &nilLogger{}
View Source
var NilWriter = &nilWriter{}

Functions

func EmergencyLog

func EmergencyLog(format string, args ...interface{})

Types

type ColorPicker

type ColorPicker interface {
	Colorize(val string) string
}

type FileFactory

type FileFactory func(prefix string) (io.WriteCloser, io.WriteCloser, error)

type LogFunc

type LogFunc func(prefix *Prefix, format string, args ...interface{})

type LogLevel

type LogLevel int
const (
	LevelDebug LogLevel = iota
	LevelInfo
	LevelWarn
	LevelError
)

type Logger

type Logger interface {
	Debug(prefix *Prefix, format string, args ...interface{})
	Info(prefix *Prefix, format string, args ...interface{})
	Warn(prefix *Prefix, format string, args ...interface{})
	Error(prefix *Prefix, format string, args ...interface{})
}

type LoggerFactory

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

func NewLoggerFactory

func NewLoggerFactory(logProcessor Processor, fileFactory FileFactory) *LoggerFactory

func (*LoggerFactory) Logger

func (f *LoggerFactory) Logger(prefix string, writePrefix bool) (Logger, error)

type Prefix

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

func NewPrefix

func NewPrefix(parts ...string) *Prefix

func (*Prefix) Append

func (p *Prefix) Append(part string) *Prefix

func (*Prefix) Len

func (p *Prefix) Len() int

func (*Prefix) Serialize

func (p *Prefix) Serialize(picker ColorPicker) string

type Processor

type Processor interface {
	Start()
	Shutdown()
	Logger(outFile, errFile io.WriteCloser, writePrefix bool) Logger
}

func NewProcessor

func NewProcessor(quiet, verbose, colorize bool) Processor

Jump to

Keyboard shortcuts

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