Bee Watch
Bee Watch is an interactive debugger for the Go programming language.
Features
- Use
Critical,InfoandTracethree levels to change debugger behavior. Display()variable values orPrintf()with customized format.- User-friendly Web UI for WebSocket mode or easy-control command-line mode.
- Call
AddWatchVars()to monitor variables and show their information when the program callsBreak(). - Configuration file with your customized settings(
beewatch.json).
Installation
Bee Watch is a “go get” able Go project, you can execute the following command to auto-install:
go get github.com/beego/beewatch
Attention This project can only be installed by source code now.
Quick start
Usage
package mainimport ("time""github.com/beego/beewatch")func main() {// Start with default level: Trace,// or use `beewatch.Start(beewatch.Info())` to set the level.beewatch.Start()// Some variables.appName := "Bee Watch"boolean := truenumber := 3862floatNum := 3.1415926test := "fail to watch"// Add variables to be watched, must be even sized.// Note that you have to pass the pointer.// For now it only supports basic types.// In this case, 'test' will not be watched.beewatch.AddWatchVars("test", test, "App Name", &appName,"bool", &boolean, "number", &number, "float", &floatNum)// Display something.beewatch.Info().Display("App Name", appName).Break().Printf("boolean value is %v; number is %d", boolean, number)beewatch.Critical().Break().Display("float", floatNum)// Change some values, must be even sized.appName = "Bee Watch2"number = 250// Here you will see something interesting.beewatch.Trace().Break()// Multiple goroutines test.for i := 0; i < 3; i++ {go multipletest(i)}beewatch.Trace().Printf("Wait 3 seconds...")select {case <-time.After(3 * time.Second):beewatch.Trace().Printf("Done debug")}// Close debugger,// it's not useful when you debug a web server that may not have an end.beewatch.Close()}func multipletest(num int) {beewatch.Critical().Break().Display("num", num)}
Connect
Bee Watch debugger is automatically started on http://localhost:23456 when you use WebSocket mode, you can change port and other configuration by editing beewatch.json(copy default setting from Bee Watch source folder).
Your browser has to support WebSocket, it has been tested with Chrome, Safari and Firefox on Mac and Windows.

