log

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: BSD-3-Clause, MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEverythingFromPattern

func AddEverythingFromPattern(pattern string)

AddEverythingFromPattern adds a pattern to skip log level filtering, guaranteeing all logs matching the pattern are seen

func AddNothingExceptFilter

func AddNothingExceptFilter(pattern string)

AddNothingExceptFilter enables strong filtering showing logs only for things on the approved list, adding this pattern to the list

func Debugf

func Debugf(format string, v ...interface{})

Debugf outputs the format and variables at the Debug level

func Debugln

func Debugln(v ...interface{})

Debugln outputs the variables at the Debug level

func Errorf

func Errorf(format string, v ...interface{})

Errorf outputs the format and variables at the Error level

func Errorln

func Errorln(v ...interface{})

Errorln outputs the variables at the Error level

func ExcludeFromPattern added in v1.0.4

func ExcludeFromPattern(pattern string)

ExcludeFromPattern adds a pattern to exclude logs from

func Infof

func Infof(format string, v ...interface{})

Infof outputs the format and variables at the Info level

func Infoln

func Infoln(v ...interface{})

Infoln outputs the variables at the Info level

func Printf

func Printf(level Level, format string, v ...interface{})

Printf outputs the format with variables assuming it passes the filter level

func Println

func Println(level Level, v ...interface{})

Println outputs the varibles assuming they pass the filter level

func SetLevel

func SetLevel(level Level)

SetLevel changes the filtering level of the system logger

func SetStd added in v1.0.6

func SetStd(logger *Logger)

SetStd sets the default logger all other functions use

func Warnf

func Warnf(format string, v ...interface{})

Warnf outputs the format and variables at the Warning level

func Warnln

func Warnln(v ...interface{})

Warnln outputs the variables at the Warn level

Types

type Level

type Level int

Level indicates the level a log should be classified at

const (
	LevelDebug Level = iota + 1
	LevelInfo
	LevelWarn
	LevelError
)

The possible levels a log can have

type Logger

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

Logger is a go Logger wrapper that adds log levels and pattern filtering It allows high level 'log level' filtering broadly It allows allows two addition levels of filtering:

everythingFrom which allows inclusion of packages/patterns along with general logging
nothingExcept which allows focusing on just listed areas

func New

func New(level Level) *Logger

New returns a new Logger with a filter set to the supplied level

func NewFile added in v1.0.6

func NewFile(level Level, filename string) (*Logger, error)

NewFile returns a new Logger that logs to the supplied file with a filter set to the supplied level

func (*Logger) AddEverythingFromPattern

func (l *Logger) AddEverythingFromPattern(pattern string)

AddEverythingFromPattern adds a pattern to skip log level filtering, guaranteeing all logs matching the pattern are seen

func (*Logger) AddNothingExceptFilter

func (l *Logger) AddNothingExceptFilter(pattern string)

AddNothingExceptFilter enables strong filtering showing logs only for things on the approved list, adding this pattern to the list

func (*Logger) ExcludeFromPattern added in v1.0.4

func (l *Logger) ExcludeFromPattern(pattern string)

ExcludeFromPattern adds a pattern to exclude logs from

func (*Logger) Printf

func (l *Logger) Printf(level Level, format string, v ...interface{})

Printf outputs the format and variables, assuming it passes the filter levels

func (*Logger) Println

func (l *Logger) Println(level Level, v ...interface{})

Println outputs the variables assuming the filter levels are passed

func (*Logger) SetLevel

func (l *Logger) SetLevel(level Level)

SetLevel adjusts the output filter by logging level

Jump to

Keyboard shortcuts

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