gorm日志支持显示requestId
This commit is contained in:
1 parent
5353527e6c
commit
b79747e551
3 files changed
+4
-4
No files matched your search
@@ -6,6 +6,6 @@ import (
|
||||
)
|
||||
|
||||
func WithContextDb(c *gin.Context) {
|
||||
c.Set("db", sdk.Runtime.GetDbByKey(c.Request.Host))
|
||||
c.Set("db", sdk.Runtime.GetDbByKey(c.Request.Host).WithContext(c))
|
||||
c.Next()
|
||||
}
|
||||
@@ -18,6 +18,7 @@ func RequestId(trafficKey string) gin.HandlerFunc {
|
||||
requestId = uuid.New().String()
|
||||
}
|
||||
c.Header(trafficKey, requestId)
|
||||
c.Set(trafficKey, requestId)
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user