http工具包默认注册log路由

This commit is contained in:
2025-12-30 18:27:09 +08:00
parent 636e0ec4f2
commit 65acd04e1a

View File

@@ -11,6 +11,7 @@ import (
_ "gitee.com/red-future---jilin-g/common/consul" _ "gitee.com/red-future---jilin-g/common/consul"
"gitee.com/red-future---jilin-g/common/jaeger" "gitee.com/red-future---jilin-g/common/jaeger"
"gitee.com/red-future---jilin-g/common/log/controller"
"gitee.com/red-future---jilin-g/common/utils" "gitee.com/red-future---jilin-g/common/utils"
"github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/ghttp"
@@ -46,6 +47,10 @@ func init() {
Httpclient.SetDiscovery(gsvc.GetRegistry()) Httpclient.SetDiscovery(gsvc.GetRegistry())
} }
func RouteRegister(controllers []interface{}) { func RouteRegister(controllers []interface{}) {
Httpserver.Group("/log", func(group *ghttp.RouterGroup) {
group.Middleware(jaeger.NewTracer)
group.Bind(controller.OperationLog)
})
re := regexp.MustCompile("[A-Z]") re := regexp.MustCompile("[A-Z]")
for _, t := range controllers { for _, t := range controllers {
sName := reflect.ValueOf(t).Elem().Type().Name() sName := reflect.ValueOf(t).Elem().Type().Name()