Use Echo logger

This commit is contained in:
Michael Bumann
2022-01-17 10:22:02 +01:00
parent 2e387132d1
commit 236427b8e2
4 changed files with 2 additions and 8 deletions

View File

@@ -12,7 +12,6 @@ import (
"github.com/golang-jwt/jwt"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/sirupsen/logrus"
"github.com/uptrace/bun"
)
@@ -58,7 +57,7 @@ func UserMiddleware(db *bun.DB) echo.MiddlewareFunc {
case errors.Is(err, sql.ErrNoRows):
return echo.NewHTTPError(http.StatusNotFound, "user with given ID is not found")
case err != nil:
logrus.Errorf("database error: %v", err)
c.Logger().Errorf("database error: %v", err)
return echo.NewHTTPError(http.StatusInternalServerError)
}