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

@@ -31,7 +31,7 @@ func init() {
var (
ctx = gctx.GetInitCtx()
)
g.Log().Debug(ctx, "module base init start ...")
cool.Loger.Debug(ctx, "module base init start ...")
var t bool
cool.FillInitData(ctx, "base", &model.BaseSysMenu{}, &t)
@@ -79,7 +79,7 @@ func init() {
// -- 执行函数
// SELECT reset_all_sequences();`, nil) //重置所有序列
g.Log().Debug(ctx, "module base init finished ...")
cool.Loger.Debug(ctx, "module base init finished ...")
}
@@ -121,7 +121,7 @@ func ResetAllSequences(ctx context.Context) error {
maxValueRecord, err := g.DB("default").Query(ctx, maxValueQuery)
if err != nil {
g.Log().Warning(ctx, fmt.Sprintf("获取表 %s.%s 的最大值失败: %v",
cool.Loger.Warning(ctx, fmt.Sprintf("获取表 %s.%s 的最大值失败: %v",
schemaName, tableName, err))
continue
}
@@ -141,12 +141,12 @@ func ResetAllSequences(ctx context.Context) error {
_, err = g.DB("default").Exec(ctx, resetQuery)
if err != nil {
g.Log().Warning(ctx, fmt.Sprintf("重置序列 %s.%s 失败: %v",
cool.Loger.Warning(ctx, fmt.Sprintf("重置序列 %s.%s 失败: %v",
schemaName, sequenceName, err))
continue
}
g.Log().Info(ctx, fmt.Sprintf("序列 %s.%s 已重置为 %d",
cool.Loger.Info(ctx, fmt.Sprintf("序列 %s.%s 已重置为 %d",
schemaName, sequenceName, maxValue))
}