expvarmon/ui_dummy.go

37 lines
693 B
Go
Raw Normal View History

2015-05-03 21:52:50 +08:00
package main
import (
"fmt"
"time"
)
// DummyUI is an simple console UI mockup, for testing purposes.
type DummyUI struct{}
// Init implements UI.
func (*DummyUI) Init(UIData) error { return nil }
// Close implements UI.
func (*DummyUI) Close() {}
// Update implements UI.
func (*DummyUI) Update(data UIData) {
if data.Services == nil {
return
}
fmt.Println(time.Now().Format("15:04:05 02/01"))
for _, service := range data.Services {
fmt.Printf("%s: ", service.Name)
if service.Err != nil {
2015-07-11 00:29:22 +08:00
fmt.Printf("ERROR: %s\n", service.Err)
2015-05-03 21:52:50 +08:00
continue
}
for _, name := range data.Vars {
fmt.Printf("%s: %v, ", name.Short(), service.Value(name))
}
fmt.Printf("\n")
}
}