From 8976209ee3f71da034965efd30f76d0416c9c7f8 Mon Sep 17 00:00:00 2001 From: sia Date: Mon, 25 Nov 2024 22:46:27 +0800 Subject: [PATCH] call func --- handler/url.go | 1 - service/log.go | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/handler/url.go b/handler/url.go index 5a0408d..4656763 100644 --- a/handler/url.go +++ b/handler/url.go @@ -66,7 +66,6 @@ func NewHandler(route *mux.Router) http.HandlerFunc { } service.DefaultLogFormatter( service.LogFormatterParams{StatusCode: 404, ClientIP: v[0], Method: r.Method, Path: r.URL.Path}) - http.NotFound(w, r) return } //去除掉host方便进入路由匹配 diff --git a/service/log.go b/service/log.go index 8a859a2..aa9bc99 100644 --- a/service/log.go +++ b/service/log.go @@ -121,7 +121,7 @@ func (p *LogFormatterParams) IsOutputColor() bool { } // defaultLogFormatter is the default log format function Logger middleware uses. -var DefaultLogFormatter = func(param LogFormatterParams) string { +var DefaultLogFormatter = func(param LogFormatterParams) { var statusColor, methodColor, resetColor string if param.IsOutputColor() { statusColor = param.StatusCodeColor() @@ -132,7 +132,7 @@ var DefaultLogFormatter = func(param LogFormatterParams) string { if param.Latency > time.Minute { param.Latency = param.Latency.Truncate(time.Second) } - return fmt.Sprintf("[GitProxy] |%s %3d %s| %13v | %15s |%s %-7s %s %#v\n%s", + fmt.Printf("[GitProxy] |%s %3d %s| %13v | %15s |%s %-7s %s %#v\n%s", statusColor, param.StatusCode, resetColor, param.Latency, param.ClientIP,