From d8dc56d95a35383284242d45f8ba6ec5e89cb74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E7=99=BD=E5=8D=97?= <1762386214@qq.com> Date: Wed, 6 Oct 2021 19:14:16 +0800 Subject: [PATCH] fix(log) fix panic, remove fmt.Print --- pkg/logx/define.go | 2 -- pkg/logx/logx.go | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/logx/define.go b/pkg/logx/define.go index 0ced49c..e7e2122 100644 --- a/pkg/logx/define.go +++ b/pkg/logx/define.go @@ -2,7 +2,6 @@ package logx import ( "context" - "fmt" "gitee.com/timedb/wheatCache/pkg/event" "github.com/spf13/viper" "sync" @@ -23,7 +22,6 @@ type upLogger struct { func init() { once.Do(func() { stath = viper.GetStringSlice("logPrint.stath") - fmt.Println(stath) }) } diff --git a/pkg/logx/logx.go b/pkg/logx/logx.go index a02626b..8ae7ebd 100644 --- a/pkg/logx/logx.go +++ b/pkg/logx/logx.go @@ -5,6 +5,7 @@ import ( "fmt" "gitee.com/timedb/wheatCache/pkg/event" middleMsg "gitee.com/timedb/wheatCache/pkg/middle-msg" + "os" "runtime" "strings" "time" @@ -31,6 +32,7 @@ func (l *upLogger) Error(format string, msg ...interface{}) { } func (l *upLogger) Panic(format string, msg ...interface{}) { Print("ERROR", format, msg...) + os.Exit(-1) } 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{}) { Print("ERROR", format, msg...) + os.Exit(-1) } func Print(level string, format string, msg ...interface{}) {