Skip to content

Commit 48420c9

Browse files
committed
Add header option to display Headers
1 parent 308d325 commit 48420c9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tailmq.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type Config struct {
3232
vhost *string
3333
verbose *bool
3434
prefix *bool
35+
header *bool
3536
help *bool
3637
exchangeName string
3738
globalConfigFilePath *string
@@ -47,6 +48,7 @@ func main() {
4748
config.server = flag.String("server", "", "Use predefined server from configuration")
4849
config.vhost = flag.String("vhost", "", "Define vhost to tail from")
4950
config.prefix = flag.Bool("prefix", false, "Should output be prefixed with datetime and time")
51+
config.header = flag.Bool("header", false, "Should output display headers")
5052
config.verbose = flag.Bool("verbose", false, "Do you want more informations ?")
5153
config.help = flag.Bool("help", false, "How does it work ?")
5254
config.globalConfigFilePath = flag.String("config", "", "Path of the global config file to use")
@@ -89,6 +91,12 @@ func printDelivery(d amqp.Delivery, config *Config) {
8991
}
9092
fmt.Printf(" ")
9193
}
94+
if *config.header {
95+
fmt.Printf("\n")
96+
for k,v := range(d.Headers) {
97+
fmt.Printf("Header : %s=%s\n", k, v)
98+
}
99+
}
92100
fmt.Printf("%s\n", d.Body)
93101
}
94102

0 commit comments

Comments
 (0)