Make query output more readable
This commit is contained in:
parent
003c44fd6c
commit
f6896bf12b
|
@ -1,6 +1,7 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
@ -33,7 +34,12 @@ var queryCmd = &cobra.Command{
|
||||||
time.Sleep(time.Second * time.Duration(wait))
|
time.Sleep(time.Second * time.Duration(wait))
|
||||||
|
|
||||||
for id, data := range nodes.List {
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue