summaryrefslogtreecommitdiff
path: root/vendor/github.com/gin-gonic/gin/debug.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gin-gonic/gin/debug.go')
-rw-r--r--vendor/github.com/gin-gonic/gin/debug.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/vendor/github.com/gin-gonic/gin/debug.go b/vendor/github.com/gin-gonic/gin/debug.go
index 1fc0cafe1..1761fe325 100644
--- a/vendor/github.com/gin-gonic/gin/debug.go
+++ b/vendor/github.com/gin-gonic/gin/debug.go
@@ -23,6 +23,9 @@ func IsDebugging() bool {
// DebugPrintRouteFunc indicates debug log output format.
var DebugPrintRouteFunc func(httpMethod, absolutePath, handlerName string, nuHandlers int)
+// DebugPrintFunc indicates debug log output format.
+var DebugPrintFunc func(format string, values ...interface{})
+
func debugPrintRoute(httpMethod, absolutePath string, handlers HandlersChain) {
if IsDebugging() {
nuHandlers := len(handlers)
@@ -48,12 +51,19 @@ func debugPrintLoadTemplate(tmpl *template.Template) {
}
func debugPrint(format string, values ...any) {
- if IsDebugging() {
- if !strings.HasSuffix(format, "\n") {
- format += "\n"
- }
- fmt.Fprintf(DefaultWriter, "[GIN-debug] "+format, values...)
+ if !IsDebugging() {
+ return
+ }
+
+ if DebugPrintFunc != nil {
+ DebugPrintFunc(format, values...)
+ return
+ }
+
+ if !strings.HasSuffix(format, "\n") {
+ format += "\n"
}
+ fmt.Fprintf(DefaultWriter, "[GIN-debug] "+format, values...)
}
func getMinVer(v string) (uint64, error) {