remove debugging stuff

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-13 09:05:03 -07:00
parent ebfc95089a
commit 12ab3b54a6
3 changed files with 96 additions and 65 deletions

View File

@ -2,6 +2,10 @@ run:
go build
./cloud-control-panel
debug:
go build
./cloud-control-panel --debugging
nogui:
go build
./cloud-control-panel -nogui

View File

@ -34,6 +34,7 @@ var customUsage = func() {
func parseFlags() {
var version string
var nogui bool
var debugging bool
var hostname string
var width int
var height int
@ -45,6 +46,7 @@ func parseFlags() {
flag.IntVar (&height, "height", 600, "Height of the Window")
flag.BoolVar (&nogui, "nogui", nogui, "Do not display the GUI")
flag.BoolVar (&debugging, "debugging", debugging, "Enable debugging")
// Set the output if something fails to stdout rather than stderr
flag.CommandLine.SetOutput(os.Stdout)
@ -58,10 +60,17 @@ func parseFlags() {
log.Println("flag.Parse() failed")
}
if (debugging == true) {
log.Println("ENABLE DEBUG", debugging)
} else {
log.Println("DISABLE DEBUG", debugging)
}
config.Set("width", width)
config.Set("height", height)
config.Set("hostname", hostname)
config.Set("nogui", nogui)
config.Set("debugging", debugging)
}
func parseConfig() {
@ -97,4 +106,10 @@ func parseConfig() {
if (config.String("nogui") == "true") {
log.Println("DO NOT DISPLAY THE GUI")
}
if (config.String("debugging") == "true") {
log.Println("ENABLE DEBUG", config.String("debugging"))
} else {
log.Println("DISABLE DEBUG", config.String("debugging"))
}
}

View File

@ -37,73 +37,15 @@ func makeCloudInfoBox() ui.Control {
})
vbox.Append(addXbutton, false)
vbox.Append(ui.NewLabel("Debugging:"), false)
// ATTEMPT TO ADD THE TABLE HERE
add2button := ui.NewButton("Add a Test Table")
add2button.OnClicked(func(*ui.Button) {
log.Println("send over socket")
addTableTab()
addButton := ui.NewButton("Add Account")
addButton.OnClicked(func(*ui.Button) {
log.Println("Not Implemented Yet. Try adding --debugging")
})
vbox.Append(add2button, false)
// ATTEMPT TO ADD THE TABLE HERE END
vbox.Append(addButton, false)
hbox.Append(ui.NewVerticalSeparator(), false)
// Send a test protobuf Event to localhost
add3button := ui.NewButton("Add buf to chann")
add3button.OnClicked(func(*ui.Button) {
log.Println("add protobuf event to the channel")
addSampleEvent()
})
vbox.Append(add3button, false)
add4button := ui.NewButton("Add Demo Event")
add4button.OnClicked(func(*ui.Button) {
log.Println("add demo protobuf event to the channel")
msg := pb.CreateSampleEvent()
msg.Name = "generated in addSampleEvent()"
msg.Type = pb.Event_DEMO
addEvent(msg)
})
vbox.Append(add4button, false)
add4abutton := ui.NewButton("Close Demo GUI")
add4abutton.OnClicked(func(*ui.Button) {
gui.CloseDemoUI()
})
vbox.Append(add4abutton, false)
// Send a protobuf Event over the WIT socket
add5button := ui.NewButton("Send protobuf to localhost")
add5button.OnClicked(func(*ui.Button) {
log.Println("sent a Marshal'd protobuf to a localhost socket")
sendDataToDest()
})
vbox.Append(add5button, false)
// Send a protobuf over a gorilla websocket
add6button := ui.NewButton("gorillaSendProtobuf()")
add6button.OnClicked(func(*ui.Button) {
log.Println("gorillaSendProtobuf()")
gorillaSendProtobuf()
})
vbox.Append(add6button, false)
// debug all the golang goroutines
add7button := ui.NewButton("debug.PrintStack()")
add7button.OnClicked(func(*ui.Button) {
log.Println("debug.PrintStack() (SHOULD BE JUST THIS goroutine)")
debug.PrintStack()
log.Println("ATTEMPT FULL STACK DUMP")
log.Println("ATTEMPT FULL STACK DUMP")
log.Println("ATTEMPT FULL STACK DUMP")
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
fmt.Printf("%s", buf)
})
vbox.Append(add7button, false)
if (config.String("debugging") == "true") {
addDebuggingButtons(vbox)
}
hbox.Append(ui.NewVerticalSeparator(), false)
@ -230,3 +172,73 @@ func addVmsTab(count int) *gui.TableData {
mh := gui.AddTableTab(cloudtab, 1, "Virtual Machines", count, parts)
return mh
}
func addDebuggingButtons(vbox *ui.Box) {
vbox.Append(ui.NewLabel("Debugging:"), false)
// ATTEMPT TO ADD THE TABLE HERE
add2button := ui.NewButton("Add a Test Table")
add2button.OnClicked(func(*ui.Button) {
log.Println("send over socket")
addTableTab()
})
vbox.Append(add2button, false)
// ATTEMPT TO ADD THE TABLE HERE END
// hbox.Append(ui.NewVerticalSeparator(), false)
// Send a test protobuf Event to localhost
add3button := ui.NewButton("Add buf to chann")
add3button.OnClicked(func(*ui.Button) {
log.Println("add protobuf event to the channel")
addSampleEvent()
})
vbox.Append(add3button, false)
add4button := ui.NewButton("Add Demo Event")
add4button.OnClicked(func(*ui.Button) {
log.Println("add demo protobuf event to the channel")
msg := pb.CreateSampleEvent()
msg.Name = "generated in addSampleEvent()"
msg.Type = pb.Event_DEMO
addEvent(msg)
})
vbox.Append(add4button, false)
add4abutton := ui.NewButton("Close Demo GUI")
add4abutton.OnClicked(func(*ui.Button) {
gui.CloseDemoUI()
})
vbox.Append(add4abutton, false)
// Send a protobuf Event over the WIT socket
add5button := ui.NewButton("Send protobuf to localhost")
add5button.OnClicked(func(*ui.Button) {
log.Println("sent a Marshal'd protobuf to a localhost socket")
sendDataToDest()
})
vbox.Append(add5button, false)
// Send a protobuf over a gorilla websocket
add6button := ui.NewButton("gorillaSendProtobuf()")
add6button.OnClicked(func(*ui.Button) {
log.Println("gorillaSendProtobuf()")
gorillaSendProtobuf()
})
vbox.Append(add6button, false)
// debug all the golang goroutines
add7button := ui.NewButton("debug.PrintStack()")
add7button.OnClicked(func(*ui.Button) {
log.Println("debug.PrintStack() (SHOULD BE JUST THIS goroutine)")
debug.PrintStack()
log.Println("ATTEMPT FULL STACK DUMP")
log.Println("ATTEMPT FULL STACK DUMP")
log.Println("ATTEMPT FULL STACK DUMP")
buf := make([]byte, 1<<16)
runtime.Stack(buf, true)
fmt.Printf("%s", buf)
})
vbox.Append(add7button, false)
}