Skip to content

Commit

Permalink
add trace logging for kafka headers
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Oct 18, 2023
1 parent 39309ac commit 0c5342e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions base/mqueue/mqueue_impl_gokafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/segmentio/kafka-go/sasl"
kafkaPlain "github.com/segmentio/kafka-go/sasl/plain"
kafkaScram "github.com/segmentio/kafka-go/sasl/scram"
log "github.com/sirupsen/logrus"
)

type kafkaGoReaderImpl struct {
Expand All @@ -31,6 +32,11 @@ func (t *kafkaGoReaderImpl) HandleMessages(handler MessageHandler) {
utils.LogError("err", err.Error(), "unable to read message from Kafka reader")
panic(err)
}
if !log.IsLevelEnabled(log.TraceLevel) {
for _, h := range m.Headers {
utils.LogTrace("key", h.Key, "value", string(h.Value), "kafka message header")
}
}
// At this level, all errors are fatal
kafkaMessage := KafkaMessage{Key: m.Key, Value: m.Value}
if err = handler(kafkaMessage); err != nil {
Expand Down

0 comments on commit 0c5342e

Please sign in to comment.