summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-21 11:37:00 -0600
committerJeff Carr <[email protected]>2024-01-21 11:37:00 -0600
commitba70be3064c1d082eb0e9146562b7f07dd894fb0 (patch)
treef8fc37331297233379614238bc382bf0a4235313
parentdfb7a47e8cccd82080de3d6ba97855eeb2be6593 (diff)
cleaner logging outputv0.12.20
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--action.go26
-rw-r--r--addText.go8
-rw-r--r--common.go12
-rw-r--r--debug.go6
-rw-r--r--go.sum2
-rw-r--r--main.go28
6 files changed, 32 insertions, 50 deletions
diff --git a/action.go b/action.go
index 1580bf7..a1566a8 100644
--- a/action.go
+++ b/action.go
@@ -43,31 +43,17 @@ func (n *Node) WindowVisable() bool {
func sendAction(n *Node, atype widget.ActionType) {
if n == nil {
log.Error(errors.New("Sending Action on n = nil"))
- log.Warn("Sending Action on n = nil")
return
}
n.mu.Lock()
defer n.mu.Unlock()
- // log.Warn("SENDING ACTION STRINGS n.Strings", n.strings, n.id, n.WidgetType, n.GetProgName())
-
- // if the widget is hidden, don't send actions to the plugin
- /*
- if n.hidden {
- if atype == widget.Hide {
- // well, unless this is a Hide action, then inform the toolkit
- log.Warn("SENDING HIDDEN ACTION. IS THIS A WINDOW?", n.GetProgName(), atype)
- } else {
- log.Warn("NOT SENDING HIDDEN ACTION", n.GetProgName(), atype)
- // return
- }
- }
- */
+ // log.Log(PLUG, "SENDING ACTION STRINGS n.Strings", n.strings, n.id, n.WidgetType, n.GetProgName())
// this checks to see if the window is show in the toolkit. If it is not,
// then don't send any events. Unless it is a window widget, then send events
if n.WidgetType != widget.Window {
if !n.WindowVisable() {
- log.Warn("NOT SENDING ACTION. Window is not visable", n.id, n.WidgetType, n.GetProgName())
+ log.Log(INFO, "Not sending action to widget. Window is not visable", n.id, n.WidgetType, n.GetProgName())
return
}
}
@@ -93,8 +79,6 @@ func sendAction(n *Node, atype widget.ActionType) {
for s, _ := range n.strings {
a.State.Strings = append(a.State.Strings, s)
}
- // log.Warn("SENDING ACTION STRINGS a.Strings", a.Strings)
- // log.Warn("SENDING ACTION a.State.Value", a.State.Value)
a.State.Range.Low = n.X
a.State.Range.High = n.Y
@@ -119,11 +103,11 @@ func sendAction(n *Node, atype widget.ActionType) {
// sends the action/event to each toolkit via a golang plugin channel
func sendActionToPlugin(a *widget.Action) {
for _, aplug := range allPlugins {
- log.Warn("send to toolkit =", aplug.name, "Action type=", a.ActionType, a.WidgetId)
+ log.Log(PLUG, "send to toolkit =", aplug.name, "Action type=", a.ActionType, a.WidgetId)
if aplug.pluginChan == nil {
- log.Warn("Action() retrieving the aplug.PluginChannel()", aplug.name)
+ log.Log(PLUG, "Action() retrieving the aplug.PluginChannel()", aplug.name)
aplug.pluginChan = aplug.PluginChannel()
- log.Warn("Action() retrieved", aplug.pluginChan)
+ log.Log(PLUG, "Action() retrieved", aplug.pluginChan)
}
log.Verbose("Action() SEND to pluginChan", aplug.name, a.ActionType, a.WidgetType, a.WidgetId, a.ProgName)
aplug.pluginChan <- *a
diff --git a/addText.go b/addText.go
index be72cc1..1e6a07d 100644
--- a/addText.go
+++ b/addText.go
@@ -29,7 +29,7 @@ func (n *Node) addText(newS string) {
n.strings = append(n.strings, newS)
n.mu.Unlock()
mylock.Unlock()
- log.Warn("addText() has strings:", n.strings)
+ log.Log(INFO, "addText() has strings:", n.strings)
*/
// inform the toolkits
@@ -43,9 +43,9 @@ func (n *Node) AddText(str string) bool {
if !n.Ready() {
return false
}
- log.Warn("AddText() value =", str)
- log.Warn("AddText() value =", str)
- log.Warn("AddText() value =", str)
+ log.Log(INFO, "AddText() value =", str)
+ log.Log(INFO, "AddText() value =", str)
+ log.Log(INFO, "AddText() value =", str)
// for some reason, the n.mu.Lock() doesn't seem to protect the append() function on strings
// switched to a map. I suspect that is what maps are for because they are safer
diff --git a/common.go b/common.go
index 7b9c162..c897c2c 100644
--- a/common.go
+++ b/common.go
@@ -22,8 +22,8 @@ func (n *Node) Show() *Node {
n.changed = true
if n.WidgetType == widget.Window {
- log.Warn("Show on a hidden window", n.progname)
- log.Warn("this needs to do TestDraw()")
+ log.Log(CHANGE, "Show() on a hidden window", n.progname)
+ log.Log(NOW, "Show() TO FIX: this is doing TestDraw()")
n.TestDraw()
return n
}
@@ -44,8 +44,8 @@ func (n *Node) Hide() *Node {
*/
if n.WidgetType == widget.Window {
- log.Warn("Hide on a window", n.progname)
- log.Warn("this needs to do TestDestroy() ?")
+ log.Log(CHANGE, "Hide() on a window", n.progname)
+ log.Log(CHANGE, "Hide() this needs to do TestDestroy() ?")
n.Destroy()
n.hidden = true
n.changed = true
@@ -161,12 +161,12 @@ func (n *Node) Destroy() {
if !n.Ready() {
return
}
- // if ! n.enabled { return }
n.enabled = false
n.changed = true
- log.Warn("SENDING DESTROY ON", n.WidgetType, n.id, n.GetProgName())
+ log.Log(CHANGE, "Destroy()", n.WidgetType, n.id, n.GetProgName())
+
// inform the toolkits
sendAction(n, widget.Delete)
return
diff --git a/debug.go b/debug.go
index e4f46ff..ce9eb88 100644
--- a/debug.go
+++ b/debug.go
@@ -99,9 +99,9 @@ func (n *Node) ListChildren(dump bool) {
if listChildrenParent != nil {
log.Log(NODE, "\t\t\tlistChildrenParent =", listChildrenParent.id)
if listChildrenParent.id != n.parent.id {
- log.Log(NOW, "parent =", n.parent.id, n.parent.progname)
- log.Log(NOW, "listChildrenParent =", listChildrenParent.id, listChildrenParent.progname)
- log.Log(NOW, listChildrenParent.id, "!=", n.parent.id)
+ log.Log(INFO, "parent =", n.parent.id, n.parent.progname)
+ log.Log(INFO, "listChildrenParent =", listChildrenParent.id, listChildrenParent.progname)
+ log.Log(INFO, listChildrenParent.id, "!=", n.parent.id)
log.Exit("parent.child does not match child.parent")
}
}
diff --git a/go.sum b/go.sum
index 08f0388..15e1470 100644
--- a/go.sum
+++ b/go.sum
@@ -4,8 +4,6 @@ go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
-go.wit.com/log v0.5.5 h1:bK3b94uVKgev4jB5wg06FnvCFBEapQICTSH2YW+CWr4=
-go.wit.com/log v0.5.5/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY=
diff --git a/main.go b/main.go
index 91dea02..306c674 100644
--- a/main.go
+++ b/main.go
@@ -16,7 +16,7 @@ const Xaxis = 0 // stack things horizontally
const Yaxis = 1 // stack things vertically
func init() {
- log.Log(NOW, "init() has been run")
+ log.Log(INFO, "init() has been run")
me.counter = 0
// me.prefix = "wit"
@@ -58,9 +58,9 @@ func (n *Node) findId(i int) *Node {
}
func watchCallback() {
- log.Info("guiChan() START")
+ log.Log(INFO, "guiChan() START")
for {
- log.Info("guiChan() select restarted")
+ log.Log(CHANGE, "guiChan() select restarted")
select {
case a := <-me.guiChan:
// 99.9% of events are just widget changes
@@ -133,7 +133,7 @@ func watchCallback() {
// that it doesn't matter what happens outside of here
// TODO: implement throttling someday
func (n *Node) gotUserEvent(a widget.Action) {
- log.Info("gotUserEvent() received event node =", n.id, n.progname, a.Value)
+ log.Log(CHANGE, "gotUserEvent() received event node =", n.id, n.progname, a.Value)
switch n.WidgetType {
case widget.Checkbox:
@@ -143,9 +143,9 @@ func (n *Node) gotUserEvent(a widget.Action) {
}
n.SetValue(a.Value)
- log.Info("gotUserEvent() n.Bool() =", n.Bool(), "n.String() =", n.String())
+ log.Log(CHANGE, "gotUserEvent() n.Bool() =", n.Bool(), "n.String() =", n.String())
if n.Custom == nil {
- log.Info("a Custom() function was not set for this widget")
+ log.Log(CHANGE, "a Custom() function was not set for this widget")
return
}
go n.Custom()
@@ -182,17 +182,17 @@ func (n *Node) Default() *Node {
// The window is destroyed but the application does not quit
func (n *Node) StandardClose() {
- log.Log(NOW, "wit/gui Standard Window Close. name =", n.progname)
- log.Log(NOW, "wit/gui Standard Window Close. n.Custom exit =", n.Custom)
+ log.Log(INFO, "wit/gui Standard Window Close. name =", n.progname)
+ log.Log(INFO, "wit/gui Standard Window Close. n.Custom exit =", n.Custom)
}
// The window is destroyed and the application exits
// TODO: properly exit the plugin since Quit() doesn't do it
func StandardExit() {
- log.Log(NOW, "wit/gui Standard Window Exit. running os.Exit()")
- log.Log(NOW, "StandardExit() attempt to exit each toolkit plugin")
+ log.Log(INFO, "wit/gui Standard Window Exit. running os.Exit()")
+ log.Log(INFO, "StandardExit() attempt to exit each toolkit plugin")
for i, plug := range allPlugins {
- log.Log(NOW, "NewButton()", i, plug)
+ log.Log(INFO, "NewButton()", i, plug)
}
log.Exit(0)
}
@@ -200,10 +200,10 @@ func StandardExit() {
// The window is destroyed and the application exits
// TODO: properly exit the plugin since Quit() doesn't do it
func (n *Node) StandardExit() {
- log.Log(NOW, "wit/gui Standard Window Exit. running os.Exit()")
- log.Log(NOW, "StandardExit() attempt to exit each toolkit plugin")
+ log.Log(INFO, "wit/gui Standard Window Exit. running os.Exit()")
+ log.Log(INFO, "StandardExit() attempt to exit each toolkit plugin")
for i, plug := range allPlugins {
- log.Log(NOW, "NewButton()", i, plug)
+ log.Log(INFO, "NewButton()", i, plug)
}
log.Exit(0)
}