go.wit.com/log change
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
e2e4726ef7
commit
2b87ba4eaa
20
args.go
20
args.go
|
@ -9,7 +9,9 @@ import (
|
|||
|
||||
var INFO log.LogFlag
|
||||
var POLL log.LogFlag
|
||||
var BUG log.LogFlag
|
||||
var CHAN log.LogFlag
|
||||
var WARN log.LogFlag
|
||||
|
||||
var argDebugger ArgsDebugger
|
||||
|
||||
// This struct can be used with the go-arg package
|
||||
|
@ -25,15 +27,11 @@ func ArgDebug() bool {
|
|||
func init() {
|
||||
arg.Register(&argDebugger)
|
||||
|
||||
INFO.B = false
|
||||
INFO.Name = "INFO"
|
||||
INFO.Subsystem = "bugger"
|
||||
INFO.Desc = "simple debugging Info()"
|
||||
INFO.Register()
|
||||
full := "go.wit.com/gui/debugger"
|
||||
short := "bugger"
|
||||
|
||||
POLL.B = false
|
||||
POLL.Name = "POLL"
|
||||
POLL.Subsystem = "bugger"
|
||||
POLL.Desc = "watch the debugger poll things"
|
||||
POLL.Register()
|
||||
INFO.NewFlag("INFO", false, full, short, "simple debugging Info()")
|
||||
POLL.NewFlag("POLL", false, full, short, "watch the debugger poll things")
|
||||
CHAN.NewFlag("CHAN", true, full, short, "chan() test code output")
|
||||
WARN.NewFlag("WARN", true, full, short, "should warn the user")
|
||||
}
|
||||
|
|
22
gochan.go
22
gochan.go
|
@ -26,10 +26,10 @@ func DebugGoChannels(p *gui.Node) *gadgets.BasicWindow {
|
|||
// var debugWG sync.WaitGroup
|
||||
g.NewButton("init()", func () {
|
||||
if (debugNumberChan == nil) {
|
||||
log.Log(true, "making debugNumberChan channel")
|
||||
log.Log(CHAN, "making debugNumberChan channel")
|
||||
debugNumberChan = make(chan int)
|
||||
} else {
|
||||
log.Log(true, "debugNumberChan already made")
|
||||
log.Log(CHAN, "debugNumberChan already made")
|
||||
}
|
||||
debugWG = new(sync.WaitGroup)
|
||||
})
|
||||
|
@ -50,34 +50,34 @@ func DebugGoChannels(p *gui.Node) *gadgets.BasicWindow {
|
|||
go sendNumber(7)
|
||||
})
|
||||
g.NewButton("send 4 numbers (chan <- int)", func () {
|
||||
log.Log(true, "generateNumbers(4)")
|
||||
log.Log(CHAN, "generateNumbers(4)")
|
||||
go generateNumbers(4)
|
||||
})
|
||||
g.NewButton("debugWG.Done()", func () {
|
||||
log.Log(true, "ran debugWG.Done()")
|
||||
log.Log(CHAN, "ran debugWG.Done()")
|
||||
debugWG.Done()
|
||||
})
|
||||
g.NewButton("close chan", func () {
|
||||
log.Log(true, "close() on", debugNumberChan)
|
||||
log.Log(CHAN, "close() on", debugNumberChan)
|
||||
close(debugNumberChan)
|
||||
})
|
||||
g.NewButton("print", func () {
|
||||
log.Log(true, "waitgroup counter is ?")
|
||||
log.Log(CHAN, "waitgroup counter is ?")
|
||||
})
|
||||
return w
|
||||
}
|
||||
|
||||
func sendNumber(i int) {
|
||||
log.Log(true, "START debugNumberChan <-", i, " (sending", i, "to channel)")
|
||||
log.Log(CHAN, "START debugNumberChan <-", i, " (sending", i, "to channel)")
|
||||
debugNumberChan <- i
|
||||
debugWG.Wait()
|
||||
log.Log(true, "END debugNumberChan sendNumber() done", i)
|
||||
log.Log(CHAN, "END debugNumberChan sendNumber() done", i)
|
||||
}
|
||||
|
||||
func generateNumbers(total int) {
|
||||
fmt.Printf("START generateNumbers()\n")
|
||||
for idx := 1; idx <= total; idx++ {
|
||||
log.Log(true, "ran debugNumberChan <= idx where idx =", idx)
|
||||
log.Log(CHAN, "ran debugNumberChan <= idx where idx =", idx)
|
||||
fmt.Printf("S generateNumbers() sending %d to channel\n", idx)
|
||||
debugNumberChan <- idx
|
||||
// res, err := (<-r)()
|
||||
|
@ -90,9 +90,9 @@ func generateNumbers(total int) {
|
|||
// i equals the number of times to read values from the channel
|
||||
func printInt(i int, name string) {
|
||||
tmp := 1
|
||||
log.Log(true, "START printInt", name, "read debugNumberChan()")
|
||||
log.Log(CHAN, "START printInt", name, "read debugNumberChan()")
|
||||
for num := range debugNumberChan {
|
||||
log.Log(true, "printInt()",name, "read", num, "from channel")
|
||||
log.Log(CHAN, "printInt()",name, "read", num, "from channel")
|
||||
debugWG.Done()
|
||||
if (tmp == i) {
|
||||
return
|
||||
|
|
|
@ -73,7 +73,7 @@ func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
|
|||
var tmp debug.GCStats
|
||||
var out string
|
||||
debug.ReadGCStats(&tmp)
|
||||
log.Log(true, tmp)
|
||||
log.Log(INFO, tmp)
|
||||
out += fmt.Sprintln("LastGC:", tmp.LastGC, "// time.Time time of last collection")
|
||||
out += fmt.Sprintln("NumGC:", tmp.NumGC, "// number of garbage collections")
|
||||
out += fmt.Sprintln("PauseTotal:", tmp.PauseTotal, "// total pause for all collections")
|
||||
|
@ -125,7 +125,7 @@ func DebugGolangWindow(p *gui.Node) *gadgets.BasicWindow {
|
|||
og = w.Box().NewGroup("output").Pad()
|
||||
outputTextbox = og.NewTextbox("outputBox")
|
||||
outputTextbox.Custom = func () {
|
||||
log.Log(true, "custom TextBox() for golang output a =", outputTextbox.S)
|
||||
log.Log(INFO, "custom TextBox() for golang output a =", outputTextbox.S)
|
||||
}
|
||||
|
||||
return w
|
||||
|
|
6
main.go
6
main.go
|
@ -81,12 +81,12 @@ func DebugWindow2(newB *gui.Node, title string) *gui.Node {
|
|||
})
|
||||
|
||||
gr.NewButton("test conc", func () {
|
||||
log.Log(true, "TODO: fix me")
|
||||
log.Log(WARN, "TODO: fix me")
|
||||
// makeConc()
|
||||
})
|
||||
|
||||
gr.NewButton("List Plugins", func () {
|
||||
log.Log(true, "TODO: fix me")
|
||||
log.Log(WARN, "TODO: fix me")
|
||||
/*
|
||||
for _, aplug := range allPlugins {
|
||||
log.Log(true, "Loaded plugin:", aplug.name, aplug.filename)
|
||||
|
@ -137,7 +137,7 @@ func dropdownWindow(p *gui.Node) {
|
|||
name := dd.S
|
||||
activeWidget = mapWindows[name]
|
||||
setActiveWidget(activeWidget)
|
||||
log.Log(true, "The Window was set to", name)
|
||||
log.Log(INFO, "The Window was set to", name)
|
||||
}
|
||||
log.Log(INFO, "dd =", dd)
|
||||
if (activeWidget == nil) {
|
||||
|
|
24
widget.go
24
widget.go
|
@ -140,7 +140,7 @@ func debugAddWidgetButtons(n *gui.Node) {
|
|||
a.AddText("make something for tim for qflow")
|
||||
a.AddText("and for riscv")
|
||||
a.Custom = func () {
|
||||
log.Log(true, "custom dropdown() a =", a.Name, a.S)
|
||||
log.Log(WARN, "custom dropdown() a =", a.Name, a.S)
|
||||
}
|
||||
})
|
||||
n.NewButton("Combobox", func () {
|
||||
|
@ -148,7 +148,7 @@ func debugAddWidgetButtons(n *gui.Node) {
|
|||
a.AddText("mirrors.wit.com")
|
||||
a.AddText("go.wit.com")
|
||||
a.Custom = func () {
|
||||
log.Log(true, "custom combobox() a =", a.Name, a.S)
|
||||
log.Log(WARN, "custom combobox() a =", a.Name, a.S)
|
||||
}
|
||||
})
|
||||
n.NewButton("Grid", func () {
|
||||
|
@ -222,13 +222,13 @@ func debugAddWidgetButton(n *gui.Node) {
|
|||
activeWidget.SetNext(newX, newY)
|
||||
name = name + " (" + strconv.Itoa(newX) + "," + strconv.Itoa(newY) + ")"
|
||||
}
|
||||
log.Log(true, "New Name =", name)
|
||||
log.Log(true, "New Type =", activeLabelNewType.S)
|
||||
log.Log(true, "New X =", newX)
|
||||
log.Log(true, "New Y =", newY)
|
||||
log.Log(true, "activeWidget.NextW =", activeWidget.NextW)
|
||||
log.Log(true, "activeWidget.NextH =", activeWidget.NextH)
|
||||
log.Log(true, "Add() size (X,Y)", activeWidget.X, activeWidget.Y, "put next thing at (W,H) =", activeWidget.NextW, activeWidget.NextH)
|
||||
log.Log(INFO, "New Name =", name)
|
||||
log.Log(INFO, "New Type =", activeLabelNewType.S)
|
||||
log.Log(INFO, "New X =", newX)
|
||||
log.Log(INFO, "New Y =", newY)
|
||||
log.Log(INFO, "activeWidget.NextW =", activeWidget.NextW)
|
||||
log.Log(INFO, "activeWidget.NextH =", activeWidget.NextH)
|
||||
log.Log(INFO, "Add() size (X,Y)", activeWidget.X, activeWidget.Y, "put next thing at (W,H) =", activeWidget.NextW, activeWidget.NextH)
|
||||
activeWidget.Dump()
|
||||
|
||||
// activeWidget.X = newX
|
||||
|
@ -243,19 +243,19 @@ func debugAddWidgetButton(n *gui.Node) {
|
|||
activeWidget.NewBox(name, newB)
|
||||
case "Button":
|
||||
activeWidget.NewButton(name, func () {
|
||||
log.Log(true, "got to button", name)
|
||||
log.Log(WARN, "got to button", name)
|
||||
})
|
||||
case "Checkbox":
|
||||
a := activeWidget.NewCheckbox(name)
|
||||
a.Custom = func () {
|
||||
log.Log(true, "custom checkox func a=", a.B)
|
||||
log.Log(WARN, "custom checkox func a=", a.B)
|
||||
}
|
||||
case "Dropdown":
|
||||
a := activeWidget.NewDropdown(name)
|
||||
a.AddText(name + " yay")
|
||||
a.AddText(name + " haha")
|
||||
a.Custom = func () {
|
||||
log.Log(true, "WTF a=", a.B)
|
||||
log.Log(WARN, "WTF a=", a.B)
|
||||
}
|
||||
case "Combobox":
|
||||
a := activeWidget.NewCombobox(name)
|
||||
|
|
Loading…
Reference in New Issue