重构日志与可观测性体系

新增单行文本编码器与结构化 GORM 日志,统一错误记录与请求日志策略,收紧日志文件权限并修复按天切分与压缩,支付回调参数脱敏,生产强制阿里云短信,RequestID 校验防注入,日志文案中文化。
This commit is contained in:
yml2213
2026-07-29 16:19:35 +08:00
parent e75f1a8519
commit 88d74aca7d
64 changed files with 896 additions and 277 deletions
+10 -2
View File
@@ -2,9 +2,11 @@ package order
import (
"context"
"log"
"hfb_sys/backend/internal/logging"
"hfb_sys/backend/internal/model"
"go.uber.org/zap"
)
func (r *Repository) prepareRefund(order *model.RentalOrder, amountCent int64, bizType string, remark string) (*refundAction, error) {
@@ -30,6 +32,12 @@ func (r *Repository) startRefundBestEffort(ctx context.Context, action *refundAc
return
}
if _, err := r.refundStarter.StartRefund(ctx, action.OrderID, action.RefundAmountCent, action.BizType, action.Remark); err != nil {
log.Printf("[order] start refund failed order_id=%d biz_type=%s amount_cent=%d err=%v", action.OrderID, action.BizType, action.RefundAmountCent, err)
logging.FromContext(ctx).Error("订单退款提交失败",
zap.String("module", "order"),
zap.Uint64("order_id", action.OrderID),
zap.String("biz_type", action.BizType),
zap.Int64("amount_cent", action.RefundAmountCent),
zap.Error(err),
)
}
}