From ec1616c1f5617b13f96809f67653f45c991f3bc6 Mon Sep 17 00:00:00 2001 From: Daniel <dhaavi@users.noreply.github.com> Date: Thu, 12 Oct 2023 17:11:31 +0200 Subject: [PATCH] Improve api logging when handler/endpoint does not exist --- api/authentication.go | 2 +- api/router.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/api/authentication.go b/api/authentication.go index 9060e29..b6a9198 100644 --- a/api/authentication.go +++ b/api/authentication.go @@ -151,7 +151,7 @@ func authenticateRequest(w http.ResponseWriter, r *http.Request, targetHandler h switch requiredPermission { //nolint:exhaustive case NotFound: // Not found. - tracer.Trace("api: authenticated handler reported: not found") + tracer.Debug("api: no API endpoint registered for this path") http.Error(w, "Not found.", http.StatusNotFound) return nil case NotSupported: diff --git a/api/router.go b/api/router.go index 029235e..a020c57 100644 --- a/api/router.go +++ b/api/router.go @@ -235,6 +235,7 @@ func (mh *mainHandler) handle(w http.ResponseWriter, r *http.Request) error { http.Error(lrw, "Method not allowed.", http.StatusMethodNotAllowed) return nil default: + tracer.Debug("api: no handler registered for this path") http.Error(lrw, "Not found.", http.StatusNotFound) return nil }