This commit is contained in:
2025-11-14 12:11:44 +08:00
commit 39ebf61572
88 changed files with 9999 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package logging
import "github.com/sirupsen/logrus"
// BaseFields 构建 action + 配置路径等基础字段,便于不同入口复用。
func BaseFields(action, configPath string) logrus.Fields {
return logrus.Fields{
"action": action,
"configPath": configPath,
}
}
// RequestFields 提供 hub/domain/命中状态字段,供代理请求日志复用。
func RequestFields(hub, domain, hubType, authMode string, cacheHit bool) logrus.Fields {
return logrus.Fields{
"hub": hub,
"domain": domain,
"hub_type": hubType,
"auth_mode": authMode,
"cache_hit": cacheHit,
}
}