cleanup logging output

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-07 07:41:35 -06:00
parent d92457087c
commit dd425dfc81
7 changed files with 32 additions and 20 deletions

View File

@ -23,9 +23,9 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node {
}
if me.treeRoot.FindWidgetId(a.WidgetId) != nil {
log.Warn("AddNode() WidgetId already exists", a.WidgetId)
log.Warn("probably this is a Show() / Hide() issue")
log.Warn("TODO: figure out what to do here")
log.Log(TREEWARN, "AddNode() WidgetId already exists", a.WidgetId)
log.Log(TREEWARN, "probably this is a Show() / Hide() issue")
log.Log(TREEWARN, "TODO: figure out what to do here")
return me.treeRoot.FindWidgetId(a.WidgetId)
}

View File

@ -19,6 +19,10 @@ func (n *Node) Bool() bool {
return false // widget.GetBool(n.State.Value)
}
func (n *Node) CurrentS() string {
return n.State.CurrentS
}
func (n *Node) String() string {
switch n.WidgetType {
case widget.Button:

View File

@ -16,16 +16,16 @@ func (n *Node) ShowButtons() {
}
func (n *Node) DumpWidget(pad string) {
log.Warn("node:", pad, n.WidgetId, ",", n.WidgetType, ",", n.GetProgName())
log.Log(TREEWARN, "node:", pad, n.WidgetId, ",", n.WidgetType, ",", n.GetProgName())
}
var depth int = 0
func (n *Node) ListWidgets() {
if n == nil {
log.Warn("ERRRORRRR: n == nil in ListWidgets()")
log.Warn("ERRRORRRR: n == nil in ListWidgets()")
log.Warn("ERRRORRRR: n == nil in ListWidgets()")
log.Log(TREEWARN, "ERRRORRRR: n == nil in ListWidgets()")
log.Log(TREEWARN, "ERRRORRRR: n == nil in ListWidgets()")
log.Log(TREEWARN, "ERRRORRRR: n == nil in ListWidgets()")
return
}

View File

@ -18,7 +18,7 @@ import (
func (me *TreeInfo) SendEnableDebugger() {
if me.callback == nil {
log.Warn("SendEnableDebugger() callback == nil")
log.Log(TREEWARN, "SendEnableDebugger() callback == nil")
return
}
var a widget.Action
@ -30,22 +30,22 @@ func (me *TreeInfo) SendEnableDebugger() {
func (me *TreeInfo) SendToolkitLoad(s string) {
if me.callback == nil {
log.Warn("SendToolkitLoad() callback == nil")
log.Log(TREEWARN, "SendToolkitLoad() callback == nil")
return
}
var a widget.Action
a.ActionType = widget.ToolkitLoad
a.ProgName = me.PluginName
a.Value = s
log.Warn("SendToolkitLoad() START: toolkit load", s)
log.Log(TREEWARN, "SendToolkitLoad() START: toolkit load", s)
me.callback <- a
log.Warn("SendToolkitLoad() END: toolkit load", s)
log.Log(TREEWARN, "SendToolkitLoad() END: toolkit load", s)
return
}
func (me *TreeInfo) SendToolkitPanic() {
if me.callback == nil {
log.Warn("SendToolkitPanic() callback == nil")
log.Log(TREEWARN, "SendToolkitPanic() callback == nil")
return
}
var a widget.Action
@ -59,7 +59,7 @@ func (me *TreeInfo) SendToolkitPanic() {
func (me *TreeInfo) SendWindowCloseEvent(n *Node) {
if me.callback == nil {
log.Warn("SendWindowClose() callback == nil", n.WidgetId)
log.Log(TREEWARN, "SendWindowClose() callback == nil", n.WidgetId)
return
}
var a widget.Action
@ -88,7 +88,7 @@ func (me *TreeInfo) SendFromUser(n *Node) {
// Other goroutines must use this to access the GUI
func (me *TreeInfo) SendUserEvent(n *Node) {
if me.callback == nil {
log.Warn("SendUserEvent() callback == nil", n.WidgetId)
log.Log(TREEWARN, "SendUserEvent() callback == nil", n.WidgetId)
return
}
var a widget.Action

17
init.go
View File

@ -21,9 +21,9 @@ func (me *TreeInfo) newAction(a widget.Action) {
return
}
case widget.SetText:
log.Info("tree.SetText() a.State.CurrentS =", a.State.CurrentS)
log.Info("tree.SetText() a.State.DefaultS =", a.State.DefaultS)
log.Info("tree.SetText() a.State.NewString =", a.State.NewString)
log.Log(TREE, "tree.SetText() a.State.CurrentS =", a.State.CurrentS)
log.Log(TREE, "tree.SetText() a.State.DefaultS =", a.State.DefaultS)
log.Log(TREE, "tree.SetText() a.State.NewString =", a.State.NewString)
switch n.WidgetType {
case widget.Dropdown:
me.SetText(n, a.State.NewString)
@ -44,7 +44,14 @@ func (me *TreeInfo) newAction(a widget.Action) {
case widget.Combobox:
me.AddText(n, a.State.NewString)
default:
log.Warn("AddText() not supported on widget", n.WidgetType, n.String())
log.Log(TREEWARN, "AddText() not supported on widget", n.WidgetType, n.String())
}
case widget.Checked:
switch n.WidgetType {
case widget.Checkbox:
me.SetChecked(n, a.State.Checked)
default:
log.Log(TREEWARN, "SetChecked() not supported on widget", n.WidgetType, n.String())
}
default:
me.NodeAction(n, a.ActionType)
@ -54,7 +61,7 @@ func (me *TreeInfo) newAction(a widget.Action) {
func (me *TreeInfo) catchActionChannel() {
defer func() {
if r := recover(); r != nil {
log.Warn(me.PluginName, "tree YAHOOOO Recovered in simpleStdin()", r)
log.Log(TREEWARN, me.PluginName, "tree YAHOOOO Recovered in simpleStdin()", r)
me.SendToolkitPanic()
panic(-1)
}

View File

@ -51,7 +51,7 @@ func (n *Node) Json() []string {
case widget.Window:
tmp := fmt.Sprint("{ WidgetType :", n.WidgetType, "}")
all = append(all, tmp)
log.Warn(tmp)
log.Log(TREEWARN, tmp)
return all
default:
log.Log(TREE, "doUserEvent() type =", n.WidgetType)

View File

@ -30,6 +30,7 @@ type TreeInfo struct {
SetText func(*Node, string)
SetTitle func(*Node, string)
SetLabel func(*Node, string)
SetChecked func(*Node, bool)
}
type Node struct {