From 8566773ca05df8034a76bd4625244cffcb898872 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Wed, 24 Sep 2014 14:39:21 +0400 Subject: [PATCH] CLI debug action --- cli/main.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/cli/main.go b/cli/main.go index a9630e9..f537c3a 100644 --- a/cli/main.go +++ b/cli/main.go @@ -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) + } }, }, }