testhub/logger/logger.go

53 lines
785 B
Go
Raw Normal View History

2022-05-25 19:24:12 +02:00
package logger
import "log"
const (
Disabled = iota
InfoLevel
WarningLevel
DebugLevel
)
var loggerLevel int = InfoLevel
func SetLevel(level int) {
loggerLevel = level
}
func Info(v ...interface{}) {
if loggerLevel >= InfoLevel {
log.Println(v...)
}
}
func Infof(format string, v ...interface{}) {
if loggerLevel >= InfoLevel {
log.Printf(format, v...)
}
}
func Warning(v ...interface{}) {
if loggerLevel >= WarningLevel {
log.Println(v...)
}
}
func Warningf(format string, v ...interface{}) {
if loggerLevel >= WarningLevel {
log.Printf(format, v...)
}
}
func Debug(v ...interface{}) {
if loggerLevel >= DebugLevel {
log.Println(v...)
}
}
func Debugf(format string, v ...interface{}) {
if loggerLevel >= DebugLevel {
log.Printf(format, v...)
}
}