diff options
Diffstat (limited to 'gocui/plugin.go')
| -rw-r--r-- | gocui/plugin.go | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/gocui/plugin.go b/gocui/plugin.go index d66e8f6..2055529 100644 --- a/gocui/plugin.go +++ b/gocui/plugin.go @@ -3,11 +3,12 @@ package main import ( // if you include more than just this import // then your plugin might be doing something un-ideal (just a guess from 2023/02/27) + "go.wit.com/log" "go.wit.com/gui/widget" ) func action(a *widget.Action) { - log(logInfo, "action() START", a.WidgetId, a.ActionType, a.WidgetType, a.Name) + log.Log(INFO, "action() START", a.WidgetId, a.ActionType, a.WidgetType, a.Name) n := me.rootNode.findWidgetId(a.WidgetId) var w *guiWidget if (n != nil) { @@ -22,7 +23,7 @@ func action(a *widget.Action) { } else { // this is done to protect the plugin being 'refreshed' with the // widget binary tree. TODO: find a way to keep them in sync - log(logError, "action() Add ignored for already defined widget", + log.Log(ERROR, "action() Add ignored for already defined widget", a.WidgetId, a.ActionType, a.WidgetType, a.Name) } case widget.Show: @@ -33,12 +34,12 @@ func action(a *widget.Action) { } case widget.Set: if a.WidgetType == widget.Flag { - log(logNow, "TODO: set flag here", a.ActionType, a.WidgetType, a.Name) - log(logNow, "TODO: n.WidgetType =", n.WidgetType, "n.Name =", a.Name) + log.Log(NOW, "TODO: set flag here", a.ActionType, a.WidgetType, a.Name) + log.Log(NOW, "TODO: n.WidgetType =", n.WidgetType, "n.Name =", a.Name) } else { if (a.A == nil) { - log(logError, "TODO: Set here. a == nil id =", a.WidgetId, "type =", a.WidgetType, "Name =", a.Name) - log(logError, "TODO: Set here. id =", a.WidgetId, "n.Name =", n.Name) + log.Log(ERROR, "TODO: Set here. a == nil id =", a.WidgetId, "type =", a.WidgetType, "Name =", a.Name) + log.Log(ERROR, "TODO: Set here. id =", a.WidgetId, "n.Name =", n.Name) } else { n.Set(a.A) } @@ -48,38 +49,38 @@ func action(a *widget.Action) { case widget.AddText: n.AddText(a.S) case widget.Move: - log(logNow, "attempt to move() =", a.ActionType, a.WidgetType, a.Name) + log.Log(NOW, "attempt to move() =", a.ActionType, a.WidgetType, a.Name) case widget.CloseToolkit: - log(logNow, "attempting to close the plugin and release stdout and stderr") + log.Log(NOW, "attempting to close the plugin and release stdout and stderr") standardExit() case widget.Enable: if n.Visible() { // widget was already shown } else { - log(logInfo, "Setting Visable to true", a.Name) + log.Log(INFO, "Setting Visable to true", a.Name) n.SetVisible(true) } case widget.Disable: if n.Visible() { - log(logInfo, "Setting Visable to false", a.Name) + log.Log(INFO, "Setting Visable to false", a.Name) n.SetVisible(false) } else { // widget was already hidden } default: - log(logError, "action() ActionType =", a.ActionType, "WidgetType =", a.WidgetType, "Name =", a.Name) + log.Log(ERROR, "action() ActionType =", a.ActionType, "WidgetType =", a.WidgetType, "Name =", a.Name) } - log(logInfo, "action() END") + log.Log(INFO, "action() END") } func (n *node) AddText(text string) { if (n == nil) { - log(logNow, "widget is nil") + log.Log(NOW, "widget is nil") return } n.vals = append(n.vals, text) for i, s := range n.vals { - log(logNow, "AddText()", n.Name, i, s) + log.Log(NOW, "AddText()", n.Name, i, s) } n.SetText(text) } @@ -87,7 +88,7 @@ func (n *node) AddText(text string) { func (n *node) SetText(text string) { var changed bool = false if (n == nil) { - log(logNow, "widget is nil") + log.Log(NOW, "widget is nil") return } if (n.Text != text) { @@ -111,7 +112,7 @@ func (n *node) SetText(text string) { func (n *node) Set(val any) { // w := n.tk - log(logInfo, "Set() value =", val) + log.Log(INFO, "Set() value =", val) switch v := val.(type) { case bool: @@ -122,6 +123,6 @@ func (n *node) Set(val any) { case int: n.I = val.(int) default: - log(logError, "Set() unknown type =", val, v) + log.Log(ERROR, "Set() unknown type =", val, v) } } |
