Skip to content

Commit

Permalink
[add] debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Dec 6, 2023
1 parent a5f4764 commit 9304558
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions service/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"strings"

"github.com/gin-gonic/gin"
"github.com/yaoapp/kun/log"
"github.com/yaoapp/yao/sui/api"
)

Expand Down Expand Up @@ -42,7 +43,9 @@ func withStaticFileServer(c *gin.Context) {

// Rewrite
for _, rewrite := range rewriteRules {
log.Debug("Rewrite: %s => %s", c.Request.URL.Path, rewrite.Replacement)
if matches := rewrite.Pattern.FindStringSubmatch(c.Request.URL.Path); matches != nil {
log.Debug("Rewrite FindStringSubmatch: %s => %s", c.Request.URL.Path, rewrite.Replacement)
c.Request.URL.Path = rewrite.Pattern.ReplaceAllString(c.Request.URL.Path, rewrite.Replacement)
break
}
Expand Down

0 comments on commit 9304558

Please sign in to comment.