feat(platform): 日志管理 - 统一日志出口并屏蔽查询与 Agent 流式事件日志
新增 internal/logging,slog、标准库 log、GORM 与 Gin 访问日志共用同一 Handler,由 CANVAS_LOG_LEVEL / CANVAS_LOG_FORMAT 控制。info 级别不再输出成功的查询类请求、成功 SQL、message_end 等 Agent 流式事件和常规画布自动保存;4xx/5xx、慢请求、慢 SQL、SQL 失败与 panic 仍会记录,SQL 不内联参数值。
This commit is contained in:
1 parent
b7ff958c2d
commit
a0f025aa96
21 files changed
+602
-44
No files matched your search
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"log/slog"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -124,7 +125,7 @@ func (s *Service) cleanupDetachedUserResources(userID string, candidates []model
|
||||
if err := s.repo.DeleteDetachedResources(detached, deletionJobs); err != nil {
|
||||
return err
|
||||
}
|
||||
log.Printf("detached resource cleanup: removed %d resource rows for user %s", len(detached), userID)
|
||||
slog.Info("detached resource cleanup", "removed", len(detached), "user", userID)
|
||||
if len(deletionJobs) > 0 {
|
||||
s.runWorkerTask(func() { s.drainResourceDeletionJobs(len(deletionJobs)) })
|
||||
}
|
||||
@@ -157,7 +158,7 @@ func (s *Service) cleanupExpiredArchivedAssets() {
|
||||
deleted++
|
||||
}
|
||||
if deleted > 0 {
|
||||
log.Printf("recycle bin cleanup: deleted %d expired assets (retention: %d days)", deleted, retentionDays)
|
||||
slog.Info("recycle bin cleanup", "deleted", deleted, "retention_days", retentionDays)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user