From be652dd283d8c42adddedc66d6ba9210d5bdb511 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 1 May 2025 16:04:48 -0600 Subject: refactor: extract helper to log errors consistently --- app/controllers/dashboard/controller.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers/dashboard/controller.go') diff --git a/app/controllers/dashboard/controller.go b/app/controllers/dashboard/controller.go index 0f165ad..097834f 100644 --- a/app/controllers/dashboard/controller.go +++ b/app/controllers/dashboard/controller.go @@ -3,10 +3,10 @@ package dashboard import ( "net/http" - "github.com/xlgmokha/x/pkg/log" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/middleware" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/views" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls" ) type Controller struct { @@ -31,7 +31,7 @@ func (c *Controller) Show(w http.ResponseWriter, r *http.Request) { dto := &ViewDashboardDTO{CurrentUser: currentUser} if err := views.Render(w, "dashboard/show", dto); err != nil { - log.WithFields(r.Context(), log.Fields{"error": err}) + pls.LogError(r.Context(), err) w.WriteHeader(http.StatusInternalServerError) return } @@ -48,7 +48,7 @@ func (c *Controller) Navigation(w http.ResponseWriter, r *http.Request) { IsLoggedIn: currentUser != nil, } if err := views.Render(w, "dashboard/nav", dto); err != nil { - log.WithFields(r.Context(), log.Fields{"error": err}) + pls.LogError(r.Context(), err) w.WriteHeader(http.StatusInternalServerError) return } -- cgit v1.2.3