diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-01 16:04:48 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-07 09:21:28 -0700 |
| commit | be652dd283d8c42adddedc66d6ba9210d5bdb511 (patch) | |
| tree | 78c0c86beb06d6fb30e3fb065749422aad55ffb6 /app/controllers/dashboard | |
| parent | 524bb0c49649f5ed1d4bed693274ebe041ba1dcf (diff) | |
refactor: extract helper to log errors consistently
Diffstat (limited to 'app/controllers/dashboard')
| -rw-r--r-- | app/controllers/dashboard/controller.go | 6 |
1 files changed, 3 insertions, 3 deletions
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 } |
