log

package
v6.4.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StandardLog = 0
	DebugLog    = 1
)

Variables

View Source
var LogLevel int
View Source
var TestLogger testing.TB

Functions

func Debug

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

func Fatal

func Fatal(str string, args ...interface{})

func Print

func Print(str string)

func PrintStack

func PrintStack()

func Printf

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

func Printfln

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

func Println

func Println(str string)

func SetLevel

func SetLevel(level string)

func SetTestLogger

func SetTestLogger(tb testing.TB)

func UnsetTestLogger

func UnsetTestLogger()

Types

type FLogger

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

A FLogger represents an active logging object that generates lines of output to an io.Writer.

func New

func New(w io.Writer, level, prefix string) *FLogger

New makes a new logger with a given level

func NewLogFromConfig

func NewLogFromConfig(logPath, logLevel, prefix string) *FLogger

NewLogFromConfig outputs logs to a file given by logpath

func (*FLogger) Alert

func (logger *FLogger) Alert(args ...interface{})

Alert logs with an alert level and exits the program.

func (*FLogger) Alertf

func (logger *FLogger) Alertf(format string, args ...interface{})

Alertf logs with an alert level and exits the program. Arguments are handled in the manner of fmt.Printf.

func (*FLogger) Critical

func (logger *FLogger) Critical(args ...interface{})

Critical logs with a critical level and exits the program.

func (*FLogger) Criticalf

func (logger *FLogger) Criticalf(format string, args ...interface{})

Criticalf logs with a critical level and exits the program. Arguments are handled in the manner of fmt.Printf.

func (*FLogger) Debug

func (logger *FLogger) Debug(args ...interface{})

Debug logs with a debug level.

func (*FLogger) Debugf

func (logger *FLogger) Debugf(format string, args ...interface{})

Debugf logs with a debug level. Arguments are handled in the manner of fmt.Printf.

func (*FLogger) Emergency

func (logger *FLogger) Emergency(args ...interface{})

Emergency logs with an emergency level and exits the program.

func (*FLogger) Emergencyf

func (logger *FLogger) Emergencyf(format string, args ...interface{})

Emergencyf logs with an emergency level and exits the program. Arguments are handled in the manner of fmt.Printf.

func (*FLogger) Error

func (logger *FLogger) Error(args ...interface{})

Error logs with an error level.

func (*FLogger) Errorf

func (logger *FLogger) Errorf(format string, args ...interface{})

Errorf logs with an error level. Arguments are handled in the manner of fmt.Printf.

func (*FLogger) Info

func (logger *FLogger) Info(args ...interface{})

Info logs with an info level.

func (*FLogger) Infof

func (logger *FLogger) Infof(format string, args ...interface{})

Infof logs with an info level. Arguments are handled in the manner of fmt.Printf.

func (*FLogger) Level

func (logger *FLogger) Level() (level Level)

Level Get the current log level

func (*FLogger) Notice

func (logger *FLogger) Notice(args ...interface{})

Notice logs with a notice level.

func (*FLogger) Noticef

func (logger *FLogger) Noticef(format string, args ...interface{})

Noticef logs with a notice level. Arguments are handled in the manner of fmt.Printf.

func (*FLogger) Printf

func (logger *FLogger) Printf(format string, args ...interface{})

Printf is implemented so this logger shares the same functions as "log"

func (*FLogger) Println

func (logger *FLogger) Println(args ...interface{})

Println is implemented so this logger shares the same functions as "log"

func (*FLogger) Warning

func (logger *FLogger) Warning(args ...interface{})

Warning logs with a warning level.

func (*FLogger) Warningf

func (logger *FLogger) Warningf(format string, args ...interface{})

Warningf logs with a warning level. Arguments are handled in the manner of fmt.Printf.

type Level

type Level int8

Level specifies a level of verbosity. The available levels are the eight severities described in RFC 5424 and none.

const (
	None         Level = iota - 1
	EmergencyLvl       // 1
	AlertLvl           // 2
	CriticalLvl        // 3
	ErrorLvl           // 4
	WarningLvl         // 5
	NoticeLvl          // 6
	InfoLvl            // 7
	DebugLvl           // 8
)

Levels

Jump to

Keyboard shortcuts

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