feat : Log optimization

This commit is contained in:
zhangwenjian
2020-07-27 22:43:17 +08:00
parent f3a425a82b
commit 22124b236a
4 changed files with 36 additions and 10 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/google/uuid"
"go-admin/global"
"go-admin/models"
"go-admin/tools"
"go-admin/tools/app"
@@ -209,7 +210,7 @@ func InsetSysUserAvatar(c *gin.Context) {
guid := uuid.New().String()
filPath := "static/uploadfile/" + guid + ".jpg"
for _, file := range files {
tools.Logger.Println(file.Filename)
global.Logger.Debug(file.Filename)
// 上传文件至指定目录
_ = c.SaveUploadedFile(file, filPath)
}
+5 -4
View File
@@ -3,6 +3,7 @@ package tools
import (
"bytes"
"github.com/gin-gonic/gin"
"go-admin/global"
"go-admin/models"
"go-admin/models/tools"
tools2 "go-admin/tools"
@@ -116,17 +117,17 @@ func GenCode(c *gin.Context) {
NewText: newText,
}
if helper.OldText == helper.NewText {
tools2.Logger.Println("error !! the NewText isEqual the OldText")
global.Logger.Println("error !! the NewText isEqual the OldText")
return
}
if err := helper.DoWrok(); err != nil {
tools2.Logger.Print("error:", err.Error())
global.Logger.Print("error:", err.Error())
} else {
tools2.Logger.Print("done!")
global.Logger.Print("done!")
}
app.OK(c, "", "代码生成成功")
app.OK(c, "", "Code generated successfully")
}
func GenMenuAndApi(c *gin.Context) {