3 Star 2 Fork 1

fotomxq/weeekj_core

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
log.go 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
fotomxq 提交于 2025-02-05 18:52 +08:00 . 修改项目路径;
package RouterReport
import (
"fmt"
CoreLog "gitee.com/fotomxq/weeekj_core/v5/core/log"
OrgCore "gitee.com/fotomxq/weeekj_core/v5/org/core"
UserCore "gitee.com/fotomxq/weeekj_core/v5/user/core"
"github.com/gin-gonic/gin"
)
// 日志内部附加处理
func getLogMsg(c *gin.Context, msg string) string {
//捕捉异常
defer func() {
if r := recover(); r != nil {
CoreLog.Error("log failed, ", r, ", url: ", c.Request.RequestURI, ", msg: ", msg)
}
}()
var appendMsg string
userDataIn, b := c.Get("UserData")
if b {
userData := userDataIn.(UserCore.DataUserDataType)
appendMsg = fmt.Sprint("userID:", userData.Info.ID, ", userPhone:", userData.Info.Phone, ", ", appendMsg)
}
orgDataIn, b := c.Get("OrgData")
if b {
orgData := orgDataIn.(OrgCore.FieldsOrg)
appendMsg = fmt.Sprint("orgID:", orgData.ID, ", ", appendMsg)
}
orgBindDataIn, b := c.Get("OrgBindData")
if b {
bindData := orgBindDataIn.(OrgCore.FieldsBind)
appendMsg = fmt.Sprint("orgBindID:", bindData.ID, ", ", appendMsg)
}
if appendMsg != "" {
msg = appendMsg + " -> " + msg
}
return msg
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/fotomxq/weeekj_core.git
git@gitee.com:fotomxq/weeekj_core.git
fotomxq
weeekj_core
weeekj_core
v5.4.18

搜索帮助