显示这个部分在 debugPrintRoute 函数
““
func debugPrintRoute( httpMethod, absolutePath string, handlers HandlersChain) {
if IsDebugging() {
nuHandlers := len(handlers)
for _, h := range handlers{ //
debugPrint(” %s”, nameOfFunction(h)) //这两行是我加的。看一下是啥就知道这 4 个是什么 handler 了。
}
handlerName := nameOfFunction(handlers.Last())
if DebugPrintRouteFunc == nil {
debugPrint(“%-6s %-25s –> %s (%d handlers)n”, httpMethod, absolutePath, handlerName, nuHandlers)
} else {
DebugPrintRouteFunc( httpMethod, absolutePath, handlerName, nuHandlers)
}
}
}
““
我这里除去那个业务逻辑函数外,剩下的 3 个 handler 是
github.com/gin-gonic/gin.LoggerWithConfig.func1
github.com/gin-gonic/gin.RecoveryWithWriter.func1
github.com/gin-contrib/cors.New.func1