package router import ( "kontor-api-echo/internal/handlers" "log/slog" "github.com/labstack/echo/v5" "github.com/labstack/echo/v5/middleware" ) func New(admin *handlers.AdminHandler, media *handlers.MediaHandler) *echo.Echo { e := echo.New() skipper := func(c *echo.Context) bool { // Skip health check endpoint return c.Request().URL.Path == "/health" } e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{ LogStatus: true, LogURI: true, HandleError: true, Skipper: skipper, LogValuesFunc: func(c *echo.Context, v middleware.RequestLoggerValues) error { if v.Error == nil { slog.Info("REQUEST", "uri", v.URI, "status", v.Status) } else { slog.Info("REQUEST-ERROR", "uri", v.URI, "status", v.Status, "err", v.Error.Error()) } return nil }, })) return e }