diff --git a/internal/aghhttp/aghhttp.go b/internal/aghhttp/aghhttp.go index 59381042..94d3588d 100644 --- a/internal/aghhttp/aghhttp.go +++ b/internal/aghhttp/aghhttp.go @@ -47,7 +47,6 @@ func Error(r *http.Request, w http.ResponseWriter, code int, format string, args func ErrorAndLog( ctx context.Context, l *slog.Logger, - lvl slog.Level, r *http.Request, w http.ResponseWriter, code int, @@ -55,9 +54,8 @@ func ErrorAndLog( args ...any, ) { text := fmt.Sprintf(format, args...) - l.Log( + l.ErrorContext( ctx, - lvl, "http error", "method", r.Method, "host", r.Host, diff --git a/internal/stats/http.go b/internal/stats/http.go index be59b9b7..a6789c65 100644 --- a/internal/stats/http.go +++ b/internal/stats/http.go @@ -4,7 +4,6 @@ package stats import ( "encoding/json" - "log/slog" "net/http" "time" @@ -76,7 +75,6 @@ func (s *StatsCtx) handleStats(w http.ResponseWriter, r *http.Request) { aghhttp.ErrorAndLog( ctx, s.logger, - slog.LevelError, r, w, http.StatusInternalServerError, "Couldn't get statistics data", @@ -167,7 +165,6 @@ func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { aghhttp.ErrorAndLog( ctx, s.logger, - slog.LevelError, r, w, http.StatusBadRequest, @@ -182,7 +179,6 @@ func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { aghhttp.ErrorAndLog( ctx, s.logger, - slog.LevelError, r, w, http.StatusBadRequest, @@ -213,7 +209,6 @@ func (s *StatsCtx) handlePutStatsConfig(w http.ResponseWriter, r *http.Request) aghhttp.ErrorAndLog( ctx, s.logger, - slog.LevelError, r, w, http.StatusBadRequest, @@ -229,7 +224,6 @@ func (s *StatsCtx) handlePutStatsConfig(w http.ResponseWriter, r *http.Request) aghhttp.ErrorAndLog( ctx, s.logger, - slog.LevelError, r, w, http.StatusUnprocessableEntity, @@ -246,7 +240,6 @@ func (s *StatsCtx) handlePutStatsConfig(w http.ResponseWriter, r *http.Request) aghhttp.ErrorAndLog( ctx, s.logger, - slog.LevelError, r, w, http.StatusUnprocessableEntity, @@ -261,7 +254,6 @@ func (s *StatsCtx) handlePutStatsConfig(w http.ResponseWriter, r *http.Request) aghhttp.ErrorAndLog( ctx, s.logger, - slog.LevelError, r, w, http.StatusUnprocessableEntity, @@ -288,7 +280,6 @@ func (s *StatsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { aghhttp.ErrorAndLog( r.Context(), s.logger, - slog.LevelError, r, w, http.StatusInternalServerError,