import cycle not allowed

This commit is contained in:
2023-01-18 17:46:25 +08:00
parent 8d3a64b26e
commit 26f46f1eb6
35 changed files with 355 additions and 341 deletions
+5 -4
View File
@@ -3,6 +3,7 @@ package logger
import (
"cutego/pkg/common"
"cutego/pkg/config"
"cutego/pkg/logging"
"fmt"
"github.com/druidcaesa/gotool"
"github.com/gin-gonic/gin"
@@ -16,18 +17,18 @@ import (
// LoggerToFile 日志记录到文件
func LoggerToFile() gin.HandlerFunc {
dirPath := common.GetDirPath("log")
fileName := path.Join(dirPath, "application.log")
dirPath := common.GetDirPath("logging")
fileName := path.Join(dirPath, "application.logging")
if !common.IsFileOrDirExist(dirPath) {
err := common.CreateAllDir(dirPath)
if err != nil {
common.ErrorLog(err)
logging.ErrorLog(err)
}
}
if !gotool.FileUtils.Exists(fileName) {
create, err := os.Create(fileName)
if err != nil {
common.ErrorLog(err)
logging.ErrorLog(err)
}
defer create.Close()
}