Replace all log.Println and fmt.Printf with Zap structured logging
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user