refactor(logging): 统一使用自定义Loger替代g.Log()日志记录

This commit is contained in:
1
2025-07-26 03:48:06 +00:00
parent dcc5ef047c
commit 5d2b48ccc0
26 changed files with 72 additions and 73 deletions

View File

@@ -41,7 +41,7 @@ func RunFunc(ctx g.Ctx, funcstring string) (err error) {
if !FuncMap[funcName].IsAllWorker() {
// 检查当前是否为主进程, 如果不是主进程, 则不执行
if ProcessFlag != CacheManager.MustGetOrSet(ctx, "cool:masterflag", ProcessFlag, 60*time.Second).String() {
g.Log().Debug(ctx, "当前进程不是主进程, 不执行单例函数", funcName)
Loger.Debug(ctx, "当前进程不是主进程, 不执行单例函数", funcName)
return
}
}
@@ -79,7 +79,7 @@ func ListenFunc(ctx g.Ctx) {
for {
data, err := conn.Receive(ctx)
if err != nil {
g.Log().Error(ctx, err)
Loger.Error(ctx, err)
time.Sleep(10 * time.Second)
continue
}
@@ -89,10 +89,10 @@ func ListenFunc(ctx g.Ctx) {
continue
}
if dataMap["Channel"] == "cool:func" {
g.Log().Debug(ctx, "执行函数", dataMap["Payload"])
Loger.Debug(ctx, "执行函数", dataMap["Payload"])
err := RunFunc(ctx, dataMap["Payload"])
if err != nil {
g.Log().Error(ctx, "执行函数失败", err)
Loger.Error(ctx, "执行函数失败", err)
}
}
}