From a356ca4f4957076aa2a24bd72b163f0216f67c20 Mon Sep 17 00:00:00 2001 From: Snowykami Date: Mon, 16 Jun 2025 15:47:33 +0800 Subject: [PATCH] add logging for URL redirection in main.go --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index f5f3987..202f32c 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "context" "github.com/cloudwego/hertz/pkg/app" "github.com/cloudwego/hertz/pkg/app/server" + "github.com/cloudwego/hertz/pkg/common/hlog" "strings" ) @@ -31,7 +32,9 @@ func main() { } } } + oldURL := scheme + "://" + host + string(c.Request.RequestURI()) newURL := scheme + "://" + newHost + string(c.Request.RequestURI()) + hlog.Infof("Redirecting from %s to %s", oldURL, newURL) c.Redirect(301, []byte(newURL)) c.Abort() return