feat: login with apple
This commit is contained in:
25
middleware/trace.go
Normal file
25
middleware/trace.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/nose7en/ToyBoomServer/common"
|
||||
"github.com/nose7en/ToyBoomServer/utils"
|
||||
)
|
||||
|
||||
func Trace() func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
UpStreamTraceID := c.GetHeader(common.TraceIDKey)
|
||||
if len(UpStreamTraceID) > 0 {
|
||||
c.Set(common.TraceIDKey, UpStreamTraceID)
|
||||
common.Logger(c).Infof("get a common request, upstream traceid %v",
|
||||
c.GetString(common.TraceIDKey))
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
|
||||
c.Set(common.TraceIDKey, utils.GenerateUID())
|
||||
common.Logger(c).Infof("get a common request, gen traceid %v",
|
||||
c.GetString(common.TraceIDKey))
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user