From 0bc48c6f3ed2682bec686e0615eabed6238a574f Mon Sep 17 00:00:00 2001 From: Sotirios Mantziaris Date: Mon, 6 Nov 2023 23:33:41 +0200 Subject: [PATCH] Slog upgrade with Go 1.21 --- examples/service/amqp.go | 4 ++-- examples/service/http.go | 2 +- examples/service/kafka.go | 2 +- examples/service/sqs.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/service/amqp.go b/examples/service/amqp.go index 359742584..d7a155fa2 100644 --- a/examples/service/amqp.go +++ b/examples/service/amqp.go @@ -21,9 +21,9 @@ func createAMQPConsumer() (patron.Component, error) { for _, msg := range batch.Messages() { err := msg.ACK() if err != nil { - log.FromContext(msg.Context()).Info("amqp message %s received but ack failed: %v", msg.ID(), err) + log.FromContext(msg.Context()).Info("amqp message received but ack failed", "msgID", msg.ID(), "error", err) } - log.FromContext(msg.Context()).Info("amqp message %s received and acked", msg.ID()) + log.FromContext(msg.Context()).Info("amqp message received and acked", "msgID", msg.ID()) } } diff --git a/examples/service/http.go b/examples/service/http.go index b694135ad..e5fb789e6 100644 --- a/examples/service/http.go +++ b/examples/service/http.go @@ -21,7 +21,7 @@ func createHttpRouter() (patron.Component, error) { return } - log.FromContext(req.Context()).Info("HTTP request received: %s", string(body)) + log.FromContext(req.Context()).Info("HTTP request received", "body", string(body)) rw.WriteHeader(http.StatusOK) } diff --git a/examples/service/kafka.go b/examples/service/kafka.go index e9c5bdd83..e3e2b3bb5 100644 --- a/examples/service/kafka.go +++ b/examples/service/kafka.go @@ -20,7 +20,7 @@ func createKafkaConsumer() (patron.Component, error) { process := func(batch kafka.Batch) error { for _, msg := range batch.Messages() { - log.FromContext(msg.Context()).Info("kafka message received: %s", string(msg.Message().Value)) + log.FromContext(msg.Context()).Info("kafka message received", "msg", string(msg.Message().Value)) } return nil } diff --git a/examples/service/sqs.go b/examples/service/sqs.go index e8b22cc43..3011adc5f 100644 --- a/examples/service/sqs.go +++ b/examples/service/sqs.go @@ -17,9 +17,9 @@ func createSQSConsumer() (patron.Component, error) { for _, msg := range btc.Messages() { err := msg.ACK() if err != nil { - log.FromContext(msg.Context()).Info("AWS SQS message %s received but ack failed: %v", msg.ID(), err) + log.FromContext(msg.Context()).Info("AWS SQS message received but ack failed", "msgID", msg.ID(), "error", err) } - log.FromContext(msg.Context()).Info("AWS SQS message %s received and acked", msg.ID()) + log.FromContext(msg.Context()).Info("AWS SQS message received and acked", "msgID", msg.ID()) } }