glo: github.com/lajosbencz/glo Index | Files

package glo

import "github.com/lajosbencz/glo"

Index

Package Files

facility.go filter.go formatter.go handler.go levels.go logger.go

Constants

const (
    // DefaultFormat is used by default
    DefaultFormat string = "{T} [{L}] {M}"
)

Variables

var LevelList = []Level{
    Debug,
    Info,
    Notice,
    Warning,
    Error,
    Critical,
    Alert,
    Emergency,
}

LevelList incrementally lists severities

type Facility Uses

type Facility interface {
    Logger
    LoggerDebug
    LoggerInfo
    LoggerNotice
    LoggerWarning
    LoggerError
    LoggerCritical
    LoggerAlert
    LoggerEmergency
    ClearHandlers() Facility
    PushHandler(Handler) Facility
}

Facility is the main entry when used

func NewFacility Uses

func NewFacility() Facility

NewFacility creates a logger facility, this is the main entry

func NewStdFacility Uses

func NewStdFacility() Facility

NewStdFacility creates a logger with two handlers, pointing to os.Stdout and os.Stderr anything below Error gets sent to Stdout, anything above Warning gets sent to Stderr

type Filter Uses

type Filter interface {
    Check(Level, string, ...interface{}) bool
}

Filter checks a log line against custom logic

func NewFilterLevel Uses

func NewFilterLevel(min Level) Filter

NewFilterLevel checks the level of the log (inclusive)

func NewFilterLevelRange Uses

func NewFilterLevelRange(min, max Level) Filter

NewFilterLevelRange checks if the level of the log is in a range (inclusive)

type Formatter Uses

type Formatter interface {
    Format(time.Time, Level, string, ...interface{}) string
}

Formatter formats a log event

func NewFormatter Uses

func NewFormatter(f string) Formatter

NewFormatter creates a Formatter from a string

type Handler Uses

type Handler interface {
    Logger
    SetFormatter(Formatter) Handler
    ClearFilters() Handler
    PushFilter(Filter) Handler
}

Handler logs to stdout

func NewHandler Uses

func NewHandler(writer io.Writer) Handler

NewHandler creates handler that prints to an io.Writer

type Level Uses

type Level uint16

Level defines the severity

const (
    // Debug severity
    Debug Level = 100
    // Info severity
    Info Level = 200
    // Notice severity
    Notice Level = 250
    // Warning severity
    Warning Level = 300
    // Error severity
    Error Level = 400
    // Critical severity
    Critical Level = 500
    // Alert severity
    Alert Level = 550
    // Emergency severity
    Emergency Level = 600
)

func (Level) String Uses

func (l Level) String() string

String formats the Level

type Logger Uses

type Logger interface {
    Log(Level, string, ...interface{}) error
}

Logger logs a line with a specific level

type LoggerAlert Uses

type LoggerAlert interface {
    Alert(string, ...interface{}) error
}

LoggerAlert logs an alert line

type LoggerCritical Uses

type LoggerCritical interface {
    Critical(string, ...interface{}) error
}

LoggerCritical logs a critical line

type LoggerDebug Uses

type LoggerDebug interface {
    Debug(string, ...interface{}) error
}

LoggerDebug logs a debug line

type LoggerEmergency Uses

type LoggerEmergency interface {
    Emergency(string, ...interface{}) error
}

LoggerEmergency logs an emergency line

type LoggerError Uses

type LoggerError interface {
    Error(string, ...interface{}) error
}

LoggerError logs an error line

type LoggerInfo Uses

type LoggerInfo interface {
    Info(string, ...interface{}) error
}

LoggerInfo logs an info line

type LoggerNotice Uses

type LoggerNotice interface {
    Notice(string, ...interface{}) error
}

LoggerNotice logs a notice line

type LoggerSeverity Uses

type LoggerSeverity interface {
    Logger
    LoggerDebug
    LoggerInfo
    LoggerNotice
    LoggerWarning
    LoggerError
    LoggerCritical
    LoggerAlert
    LoggerEmergency
}

LoggerSeverity includes all levels

type LoggerWarning Uses

type LoggerWarning interface {
    Warning(string, ...interface{}) error
}

LoggerWarning logs a warning line

Package glo imports 5 packages (graph). Updated 2019-01-23. Refresh now. Tools for package owners.