Make query output more readable

This commit is contained in:
Julian Kornberger 2018-04-20 08:56:06 +02:00
parent 003c44fd6c
commit f6896bf12b

View File

@ -1,6 +1,7 @@
package cmd
import (
"encoding/json"
"log"
"net"
"time"
@ -33,7 +34,12 @@ var queryCmd = &cobra.Command{
time.Sleep(time.Second * time.Duration(wait))
for id, data := range nodes.List {
log.Printf("%s: %+v", id, data)
bytes, err := json.Marshal(data)
if err != nil {
log.Printf("%s: %+v", id, err)
} else {
log.Printf("%s: %+v", id, string(bytes))
}
}
},
}