diff --git a/client/amqp/amqp.go b/client/amqp/amqp.go index f08f760f3..0f8d486af 100644 --- a/client/amqp/amqp.go +++ b/client/amqp/amqp.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "log/slog" "strconv" "time" @@ -16,7 +17,6 @@ import ( "github.com/opentracing/opentracing-go/ext" "github.com/prometheus/client_golang/prometheus" "github.com/streadway/amqp" - "golang.org/x/exp/slog" ) const ( diff --git a/client/es/elasticsearch.go b/client/es/elasticsearch.go index 0cf9cba7c..e0ae7364e 100644 --- a/client/es/elasticsearch.go +++ b/client/es/elasticsearch.go @@ -5,6 +5,7 @@ import ( "bytes" "fmt" "io/ioutil" + "log/slog" "net/http" "net/url" "os" @@ -20,7 +21,6 @@ import ( "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" ) const ( diff --git a/client/grpc/grpc.go b/client/grpc/grpc.go index 2c8b6fbbf..4822e4ae0 100644 --- a/client/grpc/grpc.go +++ b/client/grpc/grpc.go @@ -3,6 +3,7 @@ package grpc import ( "context" + "log/slog" "time" "github.com/beatlabs/patron/correlation" @@ -11,7 +12,6 @@ import ( "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" "google.golang.org/grpc" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" diff --git a/client/http/encoding/json/json.go b/client/http/encoding/json/json.go index 474e85cdc..0283bc879 100644 --- a/client/http/encoding/json/json.go +++ b/client/http/encoding/json/json.go @@ -7,13 +7,13 @@ import ( "errors" "fmt" "io" + "log/slog" "net/http" "strconv" "github.com/beatlabs/patron/encoding" "github.com/beatlabs/patron/encoding/json" "github.com/beatlabs/patron/log" - "golang.org/x/exp/slog" ) // NewRequest creates a request, encodes the body, and sets the appropriate headers. diff --git a/client/mqtt/publisher.go b/client/mqtt/publisher.go index 38f2a3fa6..4550fe8bc 100644 --- a/client/mqtt/publisher.go +++ b/client/mqtt/publisher.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "log/slog" "net/url" "strconv" "time" @@ -16,7 +17,6 @@ import ( "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" ) const componentType = "mqtt-publisher" diff --git a/client/sns/publisher.go b/client/sns/publisher.go index bf3261dd1..fc45a6865 100644 --- a/client/sns/publisher.go +++ b/client/sns/publisher.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "log/slog" "strconv" "time" @@ -17,7 +18,6 @@ import ( "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" ) const ( diff --git a/client/sns/publisher_test.go b/client/sns/publisher_test.go index b96c52a7a..940dbb576 100644 --- a/client/sns/publisher_test.go +++ b/client/sns/publisher_test.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "os" "testing" @@ -15,7 +16,6 @@ import ( "github.com/opentracing/opentracing-go/mocktracer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/exp/slog" ) func Test_New(t *testing.T) { diff --git a/client/sqs/publisher.go b/client/sqs/publisher.go index 08c47b033..eacae616a 100644 --- a/client/sqs/publisher.go +++ b/client/sqs/publisher.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "log/slog" "strconv" "time" @@ -18,7 +19,6 @@ import ( "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" ) const ( diff --git a/client/sqs/publisher_test.go b/client/sqs/publisher_test.go index 848b4cb22..0918ed439 100644 --- a/client/sqs/publisher_test.go +++ b/client/sqs/publisher_test.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "os" "testing" @@ -16,7 +17,6 @@ import ( "github.com/opentracing/opentracing-go/mocktracer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/exp/slog" ) func Test_New(t *testing.T) { diff --git a/component/amqp/component.go b/component/amqp/component.go index be33a36a5..ea52fd560 100644 --- a/component/amqp/component.go +++ b/component/amqp/component.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "log/slog" "net" "time" @@ -16,7 +17,6 @@ import ( "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" "github.com/streadway/amqp" - "golang.org/x/exp/slog" ) type messageState string diff --git a/component/async/amqp/amqp.go b/component/async/amqp/amqp.go index 0fc928719..a0719f7f1 100644 --- a/component/async/amqp/amqp.go +++ b/component/async/amqp/amqp.go @@ -10,6 +10,7 @@ import ( "context" "errors" "fmt" + "log/slog" "net" "time" @@ -22,7 +23,6 @@ import ( "github.com/google/uuid" "github.com/opentracing/opentracing-go" "github.com/streadway/amqp" - "golang.org/x/exp/slog" ) const ( diff --git a/component/async/component.go b/component/async/component.go index e2a0fc0a4..4d1459cc2 100644 --- a/component/async/component.go +++ b/component/async/component.go @@ -4,12 +4,12 @@ import ( "context" "errors" "fmt" + "log/slog" "time" patronErrors "github.com/beatlabs/patron/errors" "github.com/beatlabs/patron/log" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" ) var consumerErrors *prometheus.CounterVec diff --git a/component/async/kafka/group/group.go b/component/async/kafka/group/group.go index bd8ff2fc8..82cf5f5c5 100644 --- a/component/async/kafka/group/group.go +++ b/component/async/kafka/group/group.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "log/slog" "strings" "github.com/Shopify/sarama" @@ -12,7 +13,6 @@ import ( "github.com/beatlabs/patron/component/async/kafka" "github.com/beatlabs/patron/internal/validation" opentracing "github.com/opentracing/opentracing-go" - "golang.org/x/exp/slog" ) // Factory definition of a consumer factory. diff --git a/component/async/kafka/kafka.go b/component/async/kafka/kafka.go index 19498c22f..99c2a8440 100644 --- a/component/async/kafka/kafka.go +++ b/component/async/kafka/kafka.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "log/slog" "strconv" "time" @@ -17,7 +18,6 @@ import ( "github.com/google/uuid" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" ) const ( diff --git a/component/async/kafka/simple/duration_client.go b/component/async/kafka/simple/duration_client.go index 07cd06fd2..931394e27 100644 --- a/component/async/kafka/simple/duration_client.go +++ b/component/async/kafka/simple/duration_client.go @@ -4,10 +4,10 @@ import ( "context" "errors" "fmt" + "log/slog" "time" "github.com/beatlabs/patron/log" - "golang.org/x/exp/slog" ) type durationClient struct { diff --git a/component/async/kafka/simple/simple.go b/component/async/kafka/simple/simple.go index 07b18e97d..f77e73468 100644 --- a/component/async/kafka/simple/simple.go +++ b/component/async/kafka/simple/simple.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "log/slog" "sync" "time" @@ -12,7 +13,6 @@ import ( "github.com/beatlabs/patron/component/async" "github.com/beatlabs/patron/component/async/kafka" "github.com/beatlabs/patron/internal/validation" - "golang.org/x/exp/slog" ) // unixNanoToTimestampDivider divides unix nano seconds to valid timestamp for kafka messages. diff --git a/component/grpc/component.go b/component/grpc/component.go index 397448049..953974ccc 100644 --- a/component/grpc/component.go +++ b/component/grpc/component.go @@ -4,9 +4,9 @@ package grpc import ( "context" "fmt" + "log/slog" "net" - "golang.org/x/exp/slog" "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) diff --git a/component/grpc/observability.go b/component/grpc/observability.go index f550b163e..976e073f9 100644 --- a/component/grpc/observability.go +++ b/component/grpc/observability.go @@ -2,6 +2,7 @@ package grpc import ( "context" + "log/slog" "strings" "time" @@ -11,7 +12,6 @@ import ( "github.com/google/uuid" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" "google.golang.org/grpc" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" diff --git a/component/http/cache/cache.go b/component/http/cache/cache.go index fd4aecc46..1104e718c 100644 --- a/component/http/cache/cache.go +++ b/component/http/cache/cache.go @@ -5,13 +5,13 @@ import ( "context" "fmt" "hash/crc32" + "log/slog" "net/http" "strconv" "strings" "time" "github.com/beatlabs/patron/cache" - "golang.org/x/exp/slog" ) type validationContext int diff --git a/component/http/cache/route.go b/component/http/cache/route.go index ca5b41314..508f098d1 100644 --- a/component/http/cache/route.go +++ b/component/http/cache/route.go @@ -4,11 +4,11 @@ import ( "bytes" "errors" "fmt" + "log/slog" "net/http" "time" "github.com/beatlabs/patron/cache" - "golang.org/x/exp/slog" ) // RouteCache is the builder needed to build a cache for the corresponding route. diff --git a/component/http/check.go b/component/http/check.go index c8f203f44..5b4080dc1 100644 --- a/component/http/check.go +++ b/component/http/check.go @@ -1,10 +1,10 @@ package http import ( + "log/slog" "net/http" "github.com/beatlabs/patron/log" - "golang.org/x/exp/slog" ) // AliveStatus type representing the liveness of the service via HTTP component. diff --git a/component/http/component.go b/component/http/component.go index 72fc40f09..bcf2a34a5 100644 --- a/component/http/component.go +++ b/component/http/component.go @@ -5,13 +5,12 @@ import ( "context" "errors" "fmt" + "log/slog" "net/http" "os" "strconv" "sync" "time" - - "golang.org/x/exp/slog" ) const ( diff --git a/component/http/middleware/middleware.go b/component/http/middleware/middleware.go index 9f4f35e14..918b3b69f 100644 --- a/component/http/middleware/middleware.go +++ b/component/http/middleware/middleware.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "io" + "log/slog" "math" "net/http" "net/url" @@ -27,7 +28,6 @@ import ( "github.com/opentracing/opentracing-go/ext" tracinglog "github.com/opentracing/opentracing-go/log" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" "golang.org/x/time/rate" ) diff --git a/component/http/router/httprouter/router.go b/component/http/router/httprouter/router.go index 76ac2ba26..b47f3d8a7 100644 --- a/component/http/router/httprouter/router.go +++ b/component/http/router/httprouter/router.go @@ -2,12 +2,12 @@ package httprouter import ( "fmt" + "log/slog" "os" patronhttp "github.com/beatlabs/patron/component/http" "github.com/beatlabs/patron/component/http/middleware" "github.com/julienschmidt/httprouter" - "golang.org/x/exp/slog" ) const defaultDeflateLevel = 6 diff --git a/component/kafka/component.go b/component/kafka/component.go index 9d20c8924..ed9f4bfbc 100644 --- a/component/kafka/component.go +++ b/component/kafka/component.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "strconv" "sync" "time" @@ -17,7 +18,6 @@ import ( "github.com/google/uuid" "github.com/opentracing/opentracing-go" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" ) const ( diff --git a/component/kafka/option.go b/component/kafka/option.go index f845d2975..c6ca898ea 100644 --- a/component/kafka/option.go +++ b/component/kafka/option.go @@ -3,10 +3,10 @@ package kafka import ( "errors" "fmt" + "log/slog" "time" "github.com/Shopify/sarama" - "golang.org/x/exp/slog" ) // OptionFunc definition for configuring the component in a functional way. diff --git a/component/sqs/component.go b/component/sqs/component.go index 85d4d1a8e..03daede3e 100644 --- a/component/sqs/component.go +++ b/component/sqs/component.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "log/slog" "strconv" "strings" "time" @@ -17,7 +18,6 @@ import ( "github.com/beatlabs/patron/trace" "github.com/google/uuid" "github.com/prometheus/client_golang/prometheus" - "golang.org/x/exp/slog" ) const ( diff --git a/examples/service/grpc.go b/examples/service/grpc.go index f79b26f70..8d7c8bc79 100644 --- a/examples/service/grpc.go +++ b/examples/service/grpc.go @@ -4,13 +4,13 @@ import ( "context" "errors" "fmt" + "log/slog" "strconv" "github.com/beatlabs/patron" "github.com/beatlabs/patron/component/grpc" "github.com/beatlabs/patron/examples" "github.com/beatlabs/patron/log" - "golang.org/x/exp/slog" ) type greeterServer struct { diff --git a/examples/service/main.go b/examples/service/main.go index cd7cf4e43..74e053eb1 100644 --- a/examples/service/main.go +++ b/examples/service/main.go @@ -2,11 +2,11 @@ package main import ( "context" + "log/slog" "os" "github.com/beatlabs/patron" "github.com/beatlabs/patron/examples" - "golang.org/x/exp/slog" ) const ( diff --git a/log/log.go b/log/log.go index 83dbda203..bfb1b4806 100644 --- a/log/log.go +++ b/log/log.go @@ -3,8 +3,7 @@ package log import ( "context" - - "golang.org/x/exp/slog" + "log/slog" ) type ctxKey struct{} diff --git a/log/log_test.go b/log/log_test.go index 546fb2c3f..d4de83d4d 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -2,10 +2,10 @@ package log import ( "context" + "log/slog" "testing" "github.com/stretchr/testify/assert" - "golang.org/x/exp/slog" ) func TestContext(t *testing.T) { diff --git a/options.go b/options.go index c86eba818..36f591988 100644 --- a/options.go +++ b/options.go @@ -2,8 +2,7 @@ package patron import ( "errors" - - "golang.org/x/exp/slog" + "log/slog" ) type OptionFunc func(svc *Service) error diff --git a/options_test.go b/options_test.go index 5f740bdc2..9bc31b080 100644 --- a/options_test.go +++ b/options_test.go @@ -2,10 +2,10 @@ package patron import ( "errors" + "log/slog" "testing" "github.com/stretchr/testify/assert" - "golang.org/x/exp/slog" ) func TestLogFields(t *testing.T) { diff --git a/service.go b/service.go index 4d8864891..afbfd1c27 100644 --- a/service.go +++ b/service.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "log/slog" "os" "os/signal" "strconv" @@ -15,7 +16,6 @@ import ( "github.com/beatlabs/patron/log" "github.com/beatlabs/patron/trace" "github.com/uber/jaeger-client-go" - "golang.org/x/exp/slog" ) const ( @@ -179,7 +179,7 @@ func defaultLogAttrs(name, version string) []slog.Attr { } func setupLogging(lc logConfig) { - ho := slog.HandlerOptions{ + ho := &slog.HandlerOptions{ AddSource: true, Level: getLogLevel(), } @@ -187,9 +187,9 @@ func setupLogging(lc logConfig) { var hnd slog.Handler if lc.json { - hnd = ho.NewJSONHandler(os.Stderr) + hnd = slog.NewJSONHandler(os.Stderr, ho) } else { - hnd = ho.NewTextHandler(os.Stderr) + hnd = slog.NewTextHandler(os.Stderr, ho) } slog.New(hnd.WithAttrs(lc.attrs)) diff --git a/service_test.go b/service_test.go index 9b74e649e..8ba91e4b0 100644 --- a/service_test.go +++ b/service_test.go @@ -3,12 +3,12 @@ package patron import ( "context" "errors" + "log/slog" "os" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "golang.org/x/exp/slog" ) func TestNew(t *testing.T) { diff --git a/trace/trace.go b/trace/trace.go index 54c24ddf3..c6dbcb07d 100644 --- a/trace/trace.go +++ b/trace/trace.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "log/slog" "time" "github.com/beatlabs/patron/correlation" @@ -15,7 +16,6 @@ import ( "github.com/uber/jaeger-client-go/rpcmetrics" "github.com/uber/jaeger-lib/metrics" "github.com/uber/jaeger-lib/metrics/prometheus" - "golang.org/x/exp/slog" ) const (