优化开放接口日志分类

This commit is contained in:
yml2213
2026-07-30 21:07:10 +08:00
parent 9c3414607a
commit a16e518b6c
6 changed files with 210 additions and 9 deletions
+2
View File
@@ -43,6 +43,8 @@ func OpenAuth(cfg OpenAuthConfig) gin.HandlerFunc {
}
return func(c *gin.Context) {
reqID := openlog.EnsureReqID(c)
side, action := openlog.ScopeFromPath(openlog.SideClient, c.Request.Method, c.Request.URL.Path)
openlog.SetScope(c, side, action)
c.Set(openlog.CtxDebug, cfg.Debug)
c.Set(openlog.CtxStart, time.Now())
c.Header("X-Request-Id", reqID)
@@ -55,6 +55,8 @@ func SourceOpenAuth(cfg SourceOpenAuthConfig) gin.HandlerFunc {
store := newSourceNonceStore()
return func(c *gin.Context) {
reqID := openlog.EnsureReqID(c)
side, action := openlog.ScopeFromPath(openlog.SideSource, c.Request.Method, c.Request.URL.Path)
openlog.SetScope(c, side, action)
c.Set(openlog.CtxDebug, cfg.Debug)
c.Set(openlog.CtxStart, time.Now())
c.Header("X-Request-Id", reqID)