diff --git a/internal/api/handler.go b/internal/api/handler.go index bfce52b7..93e811f1 100644 --- a/internal/api/handler.go +++ b/internal/api/handler.go @@ -21,6 +21,7 @@ import ( routeApi "github.com/yusing/go-proxy/internal/api/v1/route" "github.com/yusing/go-proxy/internal/auth" "github.com/yusing/go-proxy/internal/common" + "github.com/yusing/go-proxy/internal/gperr" ) // @title GoDoxy API @@ -188,8 +189,9 @@ func ErrorHandler() gin.HandlerFunc { return func(c *gin.Context) { c.Next() if len(c.Errors) > 0 { + logger := log.With().Str("uri", c.Request.RequestURI).Logger() for _, err := range c.Errors { - log.Err(err.Err).Str("uri", c.Request.RequestURI).Msg("Internal error") + gperr.LogError("Internal error", err.Err, &logger) } if !isWebSocketRequest(c) { c.JSON(http.StatusInternalServerError, apitypes.Error("Internal server error"))