logger

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

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

Debugf records the log with debug level

func EnableErrorStackTrace

func EnableErrorStackTrace()

EnableErrorStackTrace enables stack trace for ErrorTracef method

func ErrorTracef

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

ErrorTracef records the log with stack trace in error level

func Errorf

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

Errorf records the log with error level

func Fatalf

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

Fatalf records the log with fatal level and exits

func Infof

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

Infof records the log with info level

func SetLevel

func SetLevel(level Level)

SetLevel changes the logger level

func SetLogPath

func SetLogPath(logfile string)

SetLogPath sets log file name

Types

type Level

type Level int

Level type

const (
	LevelFatal Level = iota
	LevelError
	LevelInfo
	LevelDebug
)

Log level, from low to high, more high means more serious

type Logger

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

Logger represents logging object

func NewLogger

func NewLogger() *Logger

NewLogger creates default logger

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

Debugf records the log with debug level

func (*Logger) EnableErrorStackTrace

func (l *Logger) EnableErrorStackTrace()

EnableErrorStackTrace enables stack trace for ErrorTracef method

func (*Logger) ErrorTracef

func (l *Logger) ErrorTracef(format string, args ...interface{})

ErrorTracef records the log with stack trace in error level

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

Errorf records the log with error level

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

Fatalf records the log with fatal level and exits

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

Infof records the log with info level

func (*Logger) Output

func (l *Logger) Output(level Level, msg string)

Output records the log with special callstack depth and log level.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level Level)

SetLevel sets log level, any log level less than it will not log

func (*Logger) SetLogPath

func (l *Logger) SetLogPath(logfile string)

SetLogPath sets log file name

Jump to

Keyboard shortcuts

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