2021-10-05 20:52:45 +08:00
|
|
|
package logx
|
|
|
|
|
|
|
|
import (
|
2021-10-06 14:47:58 +08:00
|
|
|
"context"
|
2021-10-05 20:52:45 +08:00
|
|
|
"gitee.com/timedb/wheatCache/pkg/event"
|
2021-10-06 19:00:48 +08:00
|
|
|
"github.com/spf13/viper"
|
|
|
|
"sync"
|
2021-10-05 20:52:45 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type LogLevelState int8
|
|
|
|
|
2021-10-06 19:00:48 +08:00
|
|
|
var (
|
|
|
|
once sync.Once
|
|
|
|
stath []string
|
|
|
|
)
|
|
|
|
|
2021-10-05 20:52:45 +08:00
|
|
|
type upLogger struct {
|
2021-10-06 19:00:48 +08:00
|
|
|
ctx context.Context
|
2021-10-06 14:47:58 +08:00
|
|
|
produce event.ProduceInterface
|
2021-10-05 20:52:45 +08:00
|
|
|
}
|
|
|
|
|
2021-10-06 19:00:48 +08:00
|
|
|
func init() {
|
|
|
|
once.Do(func() {
|
|
|
|
stath = viper.GetStringSlice("logPrint.stath")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-10-05 21:36:06 +08:00
|
|
|
type logInterface interface {
|
2021-10-06 19:00:48 +08:00
|
|
|
Debug(format string, msg ...interface{})
|
|
|
|
Info(format string, msg ...interface{})
|
|
|
|
Warn(format string, msg ...interface{})
|
|
|
|
Error(format string, msg ...interface{})
|
|
|
|
Panic(format string, msg ...interface{})
|
2021-10-05 20:52:45 +08:00
|
|
|
|
2021-10-10 21:06:28 +08:00
|
|
|
Debugln(msg ...interface{})
|
|
|
|
Infoln(msg ...interface{})
|
|
|
|
Warnln(msg ...interface{})
|
|
|
|
Errorln(msg ...interface{})
|
|
|
|
Panicln(msg ...interface{})
|
|
|
|
|
2021-10-06 19:00:48 +08:00
|
|
|
Print(level string, format string, msg ...interface{})
|
2021-10-05 20:52:45 +08:00
|
|
|
}
|