From bb53e439eced3a21b08d437867b7272a98df1dcf Mon Sep 17 00:00:00 2001 From: Janos Guljas Date: Wed, 2 Aug 2023 13:34:49 +0200 Subject: [PATCH] Support the log/slog ErrorContext function --- .github/workflows/go.yml | 2 +- recovery/recovery.go | 6 +++--- servers/servers.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8761105..d3d853e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21.0-rc.2' + go-version: '1.21.0-rc.3' - name: Checkout uses: actions/checkout@v1 diff --git a/recovery/recovery.go b/recovery/recovery.go index 0a1a5dc..5594960 100644 --- a/recovery/recovery.go +++ b/recovery/recovery.go @@ -87,13 +87,13 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { if h.label != "" { debugMsg = h.label + "\n\n" + debugMsg } - h.logger.ErrorCtx(ctx, "http recovery handler", "method", r.Method, "url", r.URL.String(), "error", err, "debug", debugMsg) + h.logger.ErrorContext(ctx, "http recovery handler", "method", r.Method, "url", r.URL.String(), "error", err, "debug", debugMsg) if h.notifier != nil { go func() { defer func() { if err := recover(); err != nil { - h.logger.ErrorCtx(ctx, "http recovery handler: notify panic", slog.Any("error", err)) + h.logger.ErrorContext(ctx, "http recovery handler: notify panic", slog.Any("error", err)) } }() @@ -107,7 +107,7 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ), debugMsg, ); err != nil { - h.logger.ErrorCtx(ctx, "http recovery handler: notify", slog.Any("error", err)) + h.logger.ErrorContext(ctx, "http recovery handler: notify", slog.Any("error", err)) } }() } diff --git a/servers/servers.go b/servers/servers.go index e88ed93..3c090c4 100644 --- a/servers/servers.go +++ b/servers/servers.go @@ -239,7 +239,7 @@ func (s *Servers) Shutdown(ctx context.Context) { s.logger.Info("shutting down server", "name", srv.label()) if err := srv.Shutdown(ctx); err != nil { - s.logger.ErrorCtx(ctx, "shutting down server", "name", srv.label(), "error", err) + s.logger.ErrorContext(ctx, "shutting down server", "name", srv.label(), "error", err) } }(srv) }