From a99cdfabd06da2e3b2e35c1852d0ff71366a7dc8 Mon Sep 17 00:00:00 2001 From: Mmx233 Date: Wed, 2 Mar 2022 22:54:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=9Edebug=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E5=88=9B=E5=BB=BA=E6=97=A5=E5=BF=97=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 1 - util/log.go | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index be62dac..854cc9e 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,6 @@ func main() { ); e != nil { log.Fatalln("初始化日志失败: ", e) } - defer util.Log.CatchRecover() if global.Flags.RunningDaemon { //后台挂起模式中 diff --git a/util/log.go b/util/log.go index 44b5853..54314b6 100644 --- a/util/log.go +++ b/util/log.go @@ -27,11 +27,14 @@ func (c *loG) Init(debug, logFile, outPut bool, path string) error { c.timeStamp = time.Now().Format("2006.01.02-15.04.05") //日志路径初始化与处理 - if !strings.HasSuffix(path, "/") { - path += "/" + if c.DebugMode { + if !strings.HasSuffix(path, "/") { + path += "/" + } + c.Path = path + return os.MkdirAll(path, os.ModePerm) } - c.Path = path - return os.MkdirAll(path, os.ModePerm) + return nil } func (c *loG) time() string {