Skip to content

Commit

Permalink
Slog upgrade with Go 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
mantzas committed Nov 6, 2023
1 parent fbc2a90 commit 0bc48c6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/service/amqp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/service/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion examples/service/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions examples/service/sqs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down

0 comments on commit 0bc48c6

Please sign in to comment.