From 52283bfd63c64d9c519f0b680ffab53b5c7e791e Mon Sep 17 00:00:00 2001 From: Alex Borodin Date: Tue, 7 Jan 2025 14:56:39 +0100 Subject: [PATCH 1/2] chore: baseHttpRepo: add logging of error responses from remote --- internal/repos/http_base.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/repos/http_base.go b/internal/repos/http_base.go index 729cf683..35577c52 100644 --- a/internal/repos/http_base.go +++ b/internal/repos/http_base.go @@ -136,7 +136,10 @@ func (b *baseHttpRepo) doHttp(req *http.Request) (*http.Response, error) { resp, err := b.client.Do(req) if err != nil { - utils.GetLogger(req.Context(), "HttpRepo").Error(err.Error()) + utils.GetLogger(req.Context(), "baseHttpRepo").Error(err.Error()) + } + if resp.StatusCode >= http.StatusBadRequest { + utils.GetLogger(req.Context(), "baseHttpRepo").Debug("received error response from remote", "status", resp.StatusCode) } return resp, err } From 25cc1182a67609218a1bb97bf4e556f85fc764b5 Mon Sep 17 00:00:00 2001 From: Alex Borodin Date: Mon, 13 Jan 2025 13:54:46 +0100 Subject: [PATCH 2/2] fixup: change log level to error --- internal/repos/http_base.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/repos/http_base.go b/internal/repos/http_base.go index 35577c52..c5b99b72 100644 --- a/internal/repos/http_base.go +++ b/internal/repos/http_base.go @@ -139,7 +139,7 @@ func (b *baseHttpRepo) doHttp(req *http.Request) (*http.Response, error) { utils.GetLogger(req.Context(), "baseHttpRepo").Error(err.Error()) } if resp.StatusCode >= http.StatusBadRequest { - utils.GetLogger(req.Context(), "baseHttpRepo").Debug("received error response from remote", "status", resp.StatusCode) + utils.GetLogger(req.Context(), "baseHttpRepo").Error("received error response from remote", "status", resp.StatusCode) } return resp, err }