github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/debug/test/config_test.go (about) 1 package test 2 3 import ( 4 "fmt" 5 "github.com/isyscore/isc-gobase/debug" 6 "github.com/isyscore/isc-gobase/time" 7 "testing" 8 t0 "time" 9 ) 10 11 func TestWatcher(t *testing.T) { 12 debug.Init() 13 debug.AddWatcher("debug.test", func(key string, value string) { 14 fmt.Println("最新的值1 key=", key, ", value=", value) 15 }) 16 debug.AddWatcher("debug.test", func(key string, value string) { 17 fmt.Println("最新的值2 key=", key, ", value=", value) 18 }) 19 debug.StartWatch() 20 21 t0.Sleep(1000000000000) 22 } 23 24 func TestPush(t *testing.T) { 25 debug.Init() 26 var tim = time.TimeToStringYmdHmsS(time.Now()) 27 fmt.Println(tim) 28 debug.Update("debug.test", tim) 29 }