From 5471cb16ff175401da46aa2e836bc0dfb907e14f Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Tue, 30 Aug 2022 16:07:05 -0800 Subject: [PATCH] logger --- backend/app/api/v1/v1_ctrl_auth.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/app/api/v1/v1_ctrl_auth.go b/backend/app/api/v1/v1_ctrl_auth.go index c09e3f4..20f09f5 100644 --- a/backend/app/api/v1/v1_ctrl_auth.go +++ b/backend/app/api/v1/v1_ctrl_auth.go @@ -31,9 +31,9 @@ func (ctrl *V1Controller) HandleAuthLogin() http.HandlerFunc { if r.Header.Get("Content-Type") == HeaderFormData { err := r.ParseForm() - if err != nil { server.Respond(w, http.StatusBadRequest, server.Wrap(err)) + ctrl.log.Error(errors.New("failed to decode login form (FORM)"), logger.Props{"error": err.Error()}) return } @@ -43,6 +43,9 @@ func (ctrl *V1Controller) HandleAuthLogin() http.HandlerFunc { err := server.Decode(r, loginForm) if err != nil { + ctrl.log.Error(errors.New("failed to decode login form (JSON)"), logger.Props{ + "error": err.Error(), + }) server.Respond(w, http.StatusBadRequest, server.Wrap(err)) return } @@ -99,7 +102,7 @@ func (ctrl *V1Controller) HandleAuthLogout() http.HandlerFunc { return } - err = server.Respond(w, http.StatusNoContent, nil) + server.Respond(w, http.StatusNoContent, nil) } }