log

package module
v0.0.0-...-b41ebf3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 133

README

log

a simple go log wrapper

Documentation

Index

Constants

View Source
const (
	// Ldate flags
	Ldate = log.Ldate
	// Llongfile flags
	Llongfile = log.Llongfile
	// Lmicroseconds flags
	Lmicroseconds = log.Lmicroseconds
	// Lshortfile flags
	Lshortfile = log.Lshortfile
	// LstdFlags flags
	LstdFlags = log.LstdFlags
	// Ltime flags
	Ltime = log.Ltime
)
View Source
const (
	// LogNone log nothing
	LogNone = Level(0x0)
	// LogFatal log fatal
	LogFatal = LogNone | Level(fatalLevel)
	// LogError log error & fatal
	LogError = LogFatal | Level(errorLevel)
	// LogWarn log warn & error & fatal
	LogWarn = LogError | Level(warnLevel)
	// LogInfo log info & warn & error & fatal
	LogInfo = LogWarn | Level(infoLevel)
	// LogDebug log debug & info & warn & error & fatal
	LogDebug = LogInfo | Level(debugLevel)
	// LogAll log all
	LogAll = LogDebug
)

Variables

This section is empty.

Functions

func CrashLog

func CrashLog(file string)

CrashLog set crash log

func Debug

func Debug(v ...interface{})

Debug debug

func DebugEnabled

func DebugEnabled() bool

DebugEnabled debug enabled

func Debugf

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

Debugf debugf

func Error

func Error(v ...interface{})

Error error

func ErrorEnabled

func ErrorEnabled() bool

ErrorEnabled error enabled

func Errorf

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

Errorf errorf

func Fatal

func Fatal(v ...interface{})

Fatal fatal

func FatalEnabled

func FatalEnabled() bool

FatalEnabled fatal enabled

func Fatalf

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

Fatalf fatalf

func Info

func Info(v ...interface{})

Info info

func InfoEnabled

func InfoEnabled() bool

InfoEnabled info enabled

func Infof

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

Infof infof

func InitLog

func InitLog()

InitLog init log

func SetFlags

func SetFlags(flags int)

SetFlags set log flags

func SetHighlighting

func SetHighlighting(highlighting bool)

SetHighlighting set highlighting log

func SetLevel

func SetLevel(level Level)

SetLevel set current log level

func SetLevelByString

func SetLevelByString(level string)

SetLevelByString set log by string level

func SetLogCount

func SetLogCount(value int)

SetLogCount set log count

func SetOutput

func SetOutput(out io.Writer)

SetOutput set log file use a writer

func SetOutputByName

func SetOutputByName(path string) error

SetOutputByName set log file use file name

func SetRotateByDay

func SetRotateByDay()

SetRotateByDay set default log rotate by day

func SetRotateByHour

func SetRotateByHour()

SetRotateByHour set default log rotate by hour

func WarnEnabled

func WarnEnabled() bool

WarnEnabled warn enabled

func Warning

func Warning(v ...interface{})

Warning warning

func Warningf

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

Warningf warningf

Types

type Cfg

type Cfg struct {
	LogLevel string
	LogFile  string
}

Cfg is the log cfg

type Level

type Level int

Level log level

func GetLogLevel

func GetLogLevel() Level

GetLogLevel get current log level

type Logger

type Logger interface {
	FatalEnabled() bool
	ErrorEnabled() bool
	WarnEnabled() bool
	InfoEnabled() bool
	DebugEnabled() bool

	Info(v ...interface{})
	Infof(format string, v ...interface{})
	Debug(v ...interface{})
	Debugf(format string, v ...interface{})
	Warning(v ...interface{})
	Warningf(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
}

Logger logger interface

func NewLoggerWithPrefix

func NewLoggerWithPrefix(prefix string) Logger

NewLoggerWithPrefix returns a logger with prefix

type Type

type Type int

Type log type

Jump to

Keyboard shortcuts

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