fix(log) fix panic, remove fmt.Print

This commit is contained in:
黎白南 2021-10-06 19:14:16 +08:00
parent 87ada5f981
commit d8dc56d95a
2 changed files with 3 additions and 2 deletions

View File

@ -2,7 +2,6 @@ package logx
import ( import (
"context" "context"
"fmt"
"gitee.com/timedb/wheatCache/pkg/event" "gitee.com/timedb/wheatCache/pkg/event"
"github.com/spf13/viper" "github.com/spf13/viper"
"sync" "sync"
@ -23,7 +22,6 @@ type upLogger struct {
func init() { func init() {
once.Do(func() { once.Do(func() {
stath = viper.GetStringSlice("logPrint.stath") stath = viper.GetStringSlice("logPrint.stath")
fmt.Println(stath)
}) })
} }

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"gitee.com/timedb/wheatCache/pkg/event" "gitee.com/timedb/wheatCache/pkg/event"
middleMsg "gitee.com/timedb/wheatCache/pkg/middle-msg" middleMsg "gitee.com/timedb/wheatCache/pkg/middle-msg"
"os"
"runtime" "runtime"
"strings" "strings"
"time" "time"
@ -31,6 +32,7 @@ func (l *upLogger) Error(format string, msg ...interface{}) {
} }
func (l *upLogger) Panic(format string, msg ...interface{}) { func (l *upLogger) Panic(format string, msg ...interface{}) {
Print("ERROR", format, msg...) Print("ERROR", format, msg...)
os.Exit(-1)
} }
func (l *upLogger) Print(level string, format string, msg ...interface{}) { func (l *upLogger) Print(level string, format string, msg ...interface{}) {
@ -57,6 +59,7 @@ func Error(format string, msg ...interface{}) {
func Panic(format string, msg ...interface{}) { func Panic(format string, msg ...interface{}) {
Print("ERROR", format, msg...) Print("ERROR", format, msg...)
os.Exit(-1)
} }
func Print(level string, format string, msg ...interface{}) { func Print(level string, format string, msg ...interface{}) {