Skip to content

Commit

Permalink
Improve message formating
Browse files Browse the repository at this point in the history
  • Loading branch information
mouminoux committed Jul 26, 2018
1 parent 04d0b22 commit 5392885
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions kafkacli.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,17 @@ func main() {
}

func displayMessage(msg *sarama.ConsumerMessage) {
fmt.Printf("[%s]----------------\n", msg.Timestamp)
fmt.Printf("Headers on %s/%d:", msg.Topic, msg.Partition)
fmt.Printf("[%s] %s/%d----------------\n", msg.Timestamp, msg.Topic, msg.Partition)
fmt.Printf("Headers:")
for _, header := range msg.Headers {
fmt.Printf(" %s=%s", header.Key, header.Value)
}
fmt.Printf("\n")
fmt.Printf("Message on %s/%d: [%s]%s\n", msg.Topic, msg.Partition, msg.Key, msg.Value)
fmt.Printf("Message")
if msg.Key != nil {
fmt.Printf("[%s]%", msg.Key)
}
fmt.Printf(": %s\n", msg.Value)
}

func die(err error) {
Expand Down

0 comments on commit 5392885

Please sign in to comment.