diff options
| author | Max Resnick <max@ofmax.li> | 2024-04-09 20:53:27 -0700 |
|---|---|---|
| committer | Max Resnick <max@ofmax.li> | 2024-04-15 21:50:00 -0700 |
| commit | cf7f32e12ca118e51723a87afee05770ea12c066 (patch) | |
| tree | 6933a2b72e704d1d043014907dacdb7d7ff6ba9d /internal/authz/middleware.go | |
| parent | 888cf9db02396c2bf093752ec76b4b9654110dd6 (diff) | |
| download | go-git-server-cf7f32e12ca118e51723a87afee05770ea12c066.tar.gz | |
chore: logging/err cleanup
Diffstat (limited to '')
| -rw-r--r-- | internal/authz/middleware.go | 8 |
1 files changed, 4 insertions, 4 deletions
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)) }) } |