Replace all log.Println and fmt.Printf with Zap structured logging

This commit is contained in:
2026-05-21 23:24:55 +02:00
parent f0653489d6
commit 89c31c2856
7 changed files with 184 additions and 162 deletions
+2 -2
View File
@@ -1,7 +1,6 @@
package server
import (
"fmt"
"music-server/cmd/web"
"net/http"
"sort"
@@ -12,6 +11,7 @@ import (
"github.com/labstack/echo/v5/middleware"
echoSwagger "github.com/swaggo/echo-swagger/v2"
"music-server/internal/logging"
"go.uber.org/zap"
)
// @Title MusicServer API
@@ -105,7 +105,7 @@ func (s *Server) RegisterRoutes() http.Handler {
})
for _, r := range routes {
if (r.Method == "GET" || r.Method == "POST" || r.Method == "PUT" || r.Method == "DELETE") && !strings.Contains(r.Name, "github") {
fmt.Printf(" %s\t\t%s\n", r.Method, r.Path)
logging.GetLogger().Debug("Registered route", zap.String("method", r.Method), zap.String("path", r.Path))
}
}
return e