update kontor-echo
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
echojwt "github.com/labstack/echo-jwt/v5"
|
||||
"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.Router {
|
||||
func New(admin *handlers.AdminHandler, media *handlers.MediaHandler) *echo.Echo {
|
||||
e := echo.New()
|
||||
|
||||
skipper := func(c echo.Context) bool {
|
||||
skipper := func(c *echo.Context) bool {
|
||||
// Skip health check endpoint
|
||||
return c.Request().URL.Path == "/health"
|
||||
}
|
||||
@@ -17,14 +19,13 @@ func New(admin *handlers.AdminHandler, media *handlers.MediaHandler) *echo.Route
|
||||
e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
|
||||
LogStatus: true,
|
||||
LogURI: true,
|
||||
LogError: true,
|
||||
HandleError: true,
|
||||
Skipper: skipper,
|
||||
LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error {
|
||||
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())
|
||||
slog.Info("REQUEST-ERROR", "uri", v.URI, "status", v.Status, "err", v.Error.Error())
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user