fix: 非debug模式不创建日志目录

This commit is contained in:
Mmx233
2022-03-02 22:54:01 +08:00
parent bef90ef4d7
commit a99cdfabd0
2 changed files with 7 additions and 5 deletions

View File

@@ -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 {