From a9bd43696d99ac1c77c38e311498050ea3cb73ab Mon Sep 17 00:00:00 2001 From: huangjuajun <102564160@qq.com> Date: Tue, 31 May 2022 10:29:23 +0800 Subject: [PATCH] =?UTF-8?q?add=20Reverse:for=20v1.1.7=20=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db.go | 2 +- pay/init.go | 2 +- utils/file.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/db.go b/db/db.go index 317445a..cc3e6cc 100644 --- a/db/db.go +++ b/db/db.go @@ -32,7 +32,7 @@ func InitDB(c *md.DBCfg) error { if c.ShowLog { //根据配置文件设置日志 Db.ShowSQL(true) //设置是否打印sql Db.Logger().SetLevel(0) //设置日志等级 - //修改日志文件存放路径文件名是%s.log + //修改日志文件存放路径文件名是%s.logs path := fmt.Sprintf(c.Path, c.Name) f, err = os.OpenFile(path, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0777) if err != nil { diff --git a/pay/init.go b/pay/init.go index 223cc47..dfa82dd 100644 --- a/pay/init.go +++ b/pay/init.go @@ -26,7 +26,7 @@ func Init(host, name, user, psw string) error { cfg.MaxLifetime = 30 cfg.MaxOpenConns = 100 cfg.MaxIdleConns = 100 - cfg.Path = "logs/%s.log" + cfg.Path = "logs/%s.logs" if err := db.InitDB(&cfg); err != nil { return err } diff --git a/utils/file.go b/utils/file.go index 0d08244..a1dafed 100644 --- a/utils/file.go +++ b/utils/file.go @@ -13,7 +13,7 @@ func FileExt(fname string) string { } func FilePutContents(fileName string, content string) { - fd, _ := os.OpenFile("./tmp/"+fileName+".log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644) + fd, _ := os.OpenFile("./tmp/"+fileName+".logs", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644) fd_time := time.Now().Format("2006-01-02 15:04:05") fd_content := strings.Join([]string{"[", fd_time, "] ", content, "\n"}, "") buf := []byte(fd_content)