1
0
Fork 0

CLI debug action

This commit is contained in:
Gregory Eremin 2014-09-24 14:39:21 +04:00
parent 726416ea46
commit 8566773ca0
1 changed files with 18 additions and 2 deletions

View File

@ -109,8 +109,24 @@ func main() {
Name: "debug",
Usage: "Show server debug info",
Action: func(c *cli.Context) {
info := bsq.Status()
fmt.Println(info)
info := bsq.Debug()
fmt.Println("Burlesque version", info.Version)
fmt.Println("\nGOMAXPROCS:", info.Gomaxprocs)
fmt.Println("Goroutines:", info.Goroutines)
fmt.Println("\nKyoto Cabinet status")
max := 0
for k, _ := range info.KyotoCabinet {
if len(k) > max {
max = len(k)
}
}
format := fmt.Sprintf("%%-%ds %%v\n", max+1)
for k, v := range info.KyotoCabinet {
fmt.Printf(format, fmt.Sprintf("%s:", k), v)
}
},
},
}