Bee Watch

Build Status

Bee Watchは、Goプログラミング言語のための対話型デバッガです。

機能

  • Use Critical, Info and Trace three levels to change debugger behavior.
  • Display() variable values or Printf() 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 calls Break().
  • Configuration file with your customized settings(beewatch.json).

  • デバッガの動作を変更するためにCriticalInfoTraceの3つのレベルを使用してください。

    • Display()変数の値やprintf ()カスタマイズ形式で。
    • のためのユーザーフレンドリーなWeb UIのWebSocketモードまたは簡単コントロールコマンドラインモード。
    • AddWatchVars() を呼び出して自分の情報を変数を監視し、表示するために AddWatchVarsを呼び出します。
    • カスタマイズされた設定で設定ファイルsettings(beewatch.json)。

インストール

Bee Watch is a “go get” able Go project, you can execute the following command to auto-install: Bee WatchはGOプロジェクト、次のコマンドを実行することができ、go get自動インストールです:

  1. go get github.com/beego/beewatch

Attention This project can only be installed by source code now. 注意 このプロジェクトは、ソースコードをインストールすることだけできます。

クイックスタート

使用方法

  1. package main
  2. import (
  3. "time"
  4. "github.com/beego/beewatch"
  5. )
  6. func main() {
  7. // Start with default level: Trace,
  8. // or use `beewatch.Start(beewatch.Info())` to set the level.
  9. beewatch.Start()
  10. // Some variables.
  11. appName := "Bee Watch"
  12. boolean := true
  13. number := 3862
  14. floatNum := 3.1415926
  15. test := "fail to watch"
  16. // Add variables to be watched, must be even sized.
  17. // Note that you have to pass the pointer.
  18. // For now it only supports basic types.
  19. // In this case, 'test' will not be watched.
  20. beewatch.AddWatchVars("test", test, "App Name", &appName,
  21. "bool", &boolean, "number", &number, "float", &floatNum)
  22. // Display something.
  23. beewatch.Info().Display("App Name", appName).Break().
  24. Printf("boolean value is %v; number is %d", boolean, number)
  25. beewatch.Critical().Break().Display("float", floatNum)
  26. // Change some values, must be even sized.
  27. appName = "Bee Watch2"
  28. number = 250
  29. // Here you will see something interesting.
  30. beewatch.Trace().Break()
  31. // Multiple goroutines test.
  32. for i := 0; i < 3; i++ {
  33. go multipletest(i)
  34. }
  35. beewatch.Trace().Printf("Wait 3 seconds...")
  36. select {
  37. case <-time.After(3 * time.Second):
  38. beewatch.Trace().Printf("Done debug")
  39. }
  40. // Close debugger,
  41. // it's not useful when you debug a web server that may not have an end.
  42. beewatch.Close()
  43. }
  44. func multipletest(num int) {
  45. beewatch.Critical().Break().Display("num", num)
  46. }

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). Bee Watchデバッガが自動的に開始され、[http://localhost:23456](http://localhost:23456)**WebSocket**モードでは、`beewatch.json`を編集することにより、ポートおよびその他の設定を変更することができます使用すると、Bee Watchソースフォルダからデフォルトの設定をコピーしてください)。

例およびAPIドキュメント

お使いのブラウザがWebSocketををサポートしている必要があり、MacおよびWindows上のChrome、Safari、Firefoxでテストされています。

Bee Watch demo ! [ビーウォッチデモ] ( https://github.com/beego/beewatch/blob/master/tests/images/demo_beewatch.png?raw=true

例とAPIドキュメント

Go Walker