From 4451b47c5e4c4263828b042d6fb12d6d14c6ca2e Mon Sep 17 00:00:00 2001 From: Dzaka Ammar Date: Tue, 25 Apr 2023 23:11:52 +0700 Subject: [PATCH] exp: Update slog, adjust for changes (#1276) Updates to the most recent release of https://github.com/golang/exp. Adjusts code for API changes based on [this](https://github.com/golang/exp/commit/be6415c2b1eac0dbab46f03a0221972936de00b7#diff-e01ca481b9eee7f4ab6b255ae0e5967a0705d64792f6a8ecddd9190fec8763f3R91). Co-authored-by: Dzaka Ammar --- exp/go.mod | 2 +- exp/go.sum | 4 ++-- exp/zapslog/slog.go | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/exp/go.mod b/exp/go.mod index c67587540..695923fd5 100644 --- a/exp/go.mod +++ b/exp/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/stretchr/testify v1.8.1 go.uber.org/zap v1.24.0 - golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 + golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 ) require ( diff --git a/exp/go.sum b/exp/go.sum index 6e851fdfc..f792608dc 100644 --- a/exp/go.sum +++ b/exp/go.sum @@ -19,8 +19,8 @@ go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= -golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 h1:pVgRXcIictcr+lBQIFeiwuwtDIs4eL21OuM9nyAADmo= -golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o= +golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exp/zapslog/slog.go b/exp/zapslog/slog.go index f087493b8..39f89549a 100644 --- a/exp/zapslog/slog.go +++ b/exp/zapslog/slog.go @@ -158,8 +158,9 @@ func (h *Handler) Handle(ctx context.Context, record slog.Record) error { } fields := make([]zapcore.Field, 0, record.NumAttrs()) - record.Attrs(func(attr slog.Attr) { + record.Attrs(func(attr slog.Attr) bool { fields = append(fields, convertAttrToField(attr)) + return true }) ce.Write(fields...) return nil