From cf7f32e12ca118e51723a87afee05770ea12c066 Mon Sep 17 00:00:00 2001 From: Max Resnick Date: Tue, 9 Apr 2024 20:53:27 -0700 Subject: chore: logging/err cleanup --- internal/authz/middleware.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/authz/middleware.go') diff --git a/internal/authz/middleware.go b/internal/authz/middleware.go index 3c029b0..9031c99 100644 --- a/internal/authz/middleware.go +++ b/internal/authz/middleware.go @@ -5,7 +5,7 @@ import ( "context" "encoding/hex" "fmt" - "log" + "log/slog" "net/http" "git.ofmax.li/go-git-server/internal/admin" @@ -60,16 +60,16 @@ func Authorization(adminSvc *admin.Servicer, next http.Handler) http.Handler { action := req.Method ok, err := adminSvc.Enforce(urn, repo, action) if err != nil { - log.Printf("error running enforce %s", err) + slog.Info("error unning enforce", "error", err) http.Error(rw, "Bad Request", http.StatusBadRequest) return } if !ok { - log.Printf("Not Authorized - %s attempted access %s", urn, repo) + slog.Info("Not Authorized", "urn", urn, "repo", repo) http.Error(rw, "Access denied", http.StatusForbidden) return } - log.Printf("Method %s Url %s", action, repo) + slog.Debug("Access Attempt", "action", action, "repo", repo) next.ServeHTTP(rw, req.WithContext(ctx)) }) } -- cgit v1.2.3