From a95d9ae8fc34619d4968821c1c448adc96d84120 Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Tue, 20 Jun 2023 18:01:08 +0200 Subject: [PATCH] chore: upgrading x/exp --- examples/failover/example.go | 6 +++--- examples/fanout/example.go | 4 ++-- examples/pipe/example.go | 2 +- examples/pipe/gdpr.go | 3 ++- examples/pool/example.go | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/failover/example.go b/examples/failover/example.go index e7e637b..96a5f91 100644 --- a/examples/failover/example.go +++ b/examples/failover/example.go @@ -20,9 +20,9 @@ func main() { logger := slog.New( slogmulti.Failover()( - slog.HandlerOptions{}.NewJSONHandler(logstash1), - slog.HandlerOptions{}.NewJSONHandler(logstash2), - slog.HandlerOptions{}.NewJSONHandler(logstash3), + slog.NewJSONHandler(logstash1, &slog.HandlerOptions{}), + slog.NewJSONHandler(logstash2, &slog.HandlerOptions{}), + slog.NewJSONHandler(logstash3, &slog.HandlerOptions{}), ), ) diff --git a/examples/fanout/example.go b/examples/fanout/example.go index 02ba44d..7b16cca 100644 --- a/examples/fanout/example.go +++ b/examples/fanout/example.go @@ -32,8 +32,8 @@ func main() { logger := slog.New( slogmulti.Fanout( - slog.HandlerOptions{}.NewJSONHandler(logstash), - slog.HandlerOptions{}.NewTextHandler(stderr), + slog.NewJSONHandler(logstash, &slog.HandlerOptions{}), + slog.NewTextHandler(stderr, &slog.HandlerOptions{}), ), ) diff --git a/examples/pipe/example.go b/examples/pipe/example.go index fd9e443..14c524b 100644 --- a/examples/pipe/example.go +++ b/examples/pipe/example.go @@ -16,7 +16,7 @@ func main() { // remove PII gdprMiddleware := NewGDPRMiddleware() - sink := slog.HandlerOptions{}.NewJSONHandler(os.Stderr) + sink := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{}) logger := slog.New( slogmulti. diff --git a/examples/pipe/gdpr.go b/examples/pipe/gdpr.go index cc8b809..4ffebf6 100644 --- a/examples/pipe/gdpr.go +++ b/examples/pipe/gdpr.go @@ -4,6 +4,7 @@ import ( "context" "strings" + "github.com/samber/lo" slogmulti "github.com/samber/slog-multi" "golang.org/x/exp/slog" ) @@ -90,7 +91,7 @@ func anonymize(attr slog.Attr) slog.Attr { for i := range attrs { attrs[i] = anonymize(attrs[i]) } - return slog.Group(k, attrs...) + return slog.Group(k, lo.ToAnySlice(attrs)...) default: return slog.String(k, "*******") } diff --git a/examples/pool/example.go b/examples/pool/example.go index 94fe900..8a32ce1 100644 --- a/examples/pool/example.go +++ b/examples/pool/example.go @@ -20,9 +20,9 @@ func main() { logger := slog.New( slogmulti.Pool()( - slog.HandlerOptions{}.NewJSONHandler(logstash1), - slog.HandlerOptions{}.NewJSONHandler(logstash2), - slog.HandlerOptions{}.NewJSONHandler(logstash3), + slog.NewJSONHandler(logstash1, &slog.HandlerOptions{}), + slog.NewJSONHandler(logstash2, &slog.HandlerOptions{}), + slog.NewJSONHandler(logstash3, &slog.HandlerOptions{}), ), )