1
0

chore(web): use logger directly

(cherry picked from commit 6fb314b326d530322f1a2e674f250a265268082c)
This commit is contained in:
kolaente
2024-09-01 19:30:09 +02:00
parent fe44b7d473
commit a2ef74cade
8 changed files with 24 additions and 57 deletions

View File

@ -22,6 +22,7 @@ import (
"net/http"
"code.vikunja.io/api/pkg/db"
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/modules/auth"
"github.com/labstack/echo/v4"
@ -39,7 +40,7 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
// Bind params to struct
if err := ctx.Bind(currentStruct); err != nil {
config.LoggingProvider.Debugf("Invalid model error. Internal error was: %s", err.Error())
log.Debugf("Invalid model error. Internal error was: %s", err.Error())
var he *echo.HTTPError
if errors.As(err, &he) {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid model provided. Error was: %s", he.Message))
@ -58,7 +59,7 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
defer func() {
err = s.Close()
if err != nil {
config.LoggingProvider.Errorf("Could not close session: %s", err)
log.Errorf("Could not close session: %s", err)
}
}()
@ -69,7 +70,7 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
}
if !canDelete {
_ = s.Rollback()
config.LoggingProvider.Noticef("Tried to delete while not having the rights for it (User: %v)", currentAuth)
log.Warningf("Tried to delete while not having the rights for it (User: %v)", currentAuth)
return echo.NewHTTPError(http.StatusForbidden)
}