summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-08 22:27:17 -0600
committerJeff Carr <[email protected]>2024-01-08 22:27:17 -0600
commit7f587d9c7971b171870f5be901944ed8eee5a79b (patch)
tree40337d3263e8848fe44c18bfac63e8282150e36f
parentaa41070a98ca244a8657e3f6bce22fffc20ef1d4 (diff)
go.wit.com/log Flags change
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--args.go38
-rw-r--r--debug.go8
-rw-r--r--main.go8
-rw-r--r--plugin.go4
4 files changed, 19 insertions, 39 deletions
diff --git a/args.go b/args.go
index dfd50e3..bffd8cd 100644
--- a/args.go
+++ b/args.go
@@ -6,7 +6,7 @@ import (
)
var INFO log.LogFlag
-
+var NOW log.LogFlag
var GUI log.LogFlag
var NODE log.LogFlag
var PLUG log.LogFlag
@@ -28,33 +28,13 @@ func ArgToolkit() string {
func init() {
arg.Register(&argGui)
- INFO.B = false
- INFO.Name = "INFO"
- INFO.Subsystem = "gui"
- INFO.Desc = "Enable log.Info()"
- INFO.Register()
-
- GUI.B = false
- GUI.Name = "GUI"
- GUI.Subsystem = "gui"
- GUI.Desc = "basic GUI debugging"
- GUI.Register()
-
- NODE.B = false
- NODE.Name = "NODE"
- NODE.Subsystem = "gui"
- NODE.Desc = "basic NODE debugging"
- NODE.Register()
-
- PLUG.B = false
- PLUG.Name = "PLUG"
- PLUG.Subsystem = "gui"
- PLUG.Desc = "basic PLUG debugging"
- PLUG.Register()
+ full := "go.wit.com/gui/gui"
+ short := "gui"
- CHANGE.B = false
- CHANGE.Name = "CHANGE"
- CHANGE.Subsystem = "gui"
- CHANGE.Desc = "user changed something"
- CHANGE.Register()
+ NOW.NewFlag("NOW", true, full, short, "temp debugging stuff")
+ INFO.NewFlag("INFO", false, full, short, "General Info")
+ GUI.NewFlag("GUI", false, full, short, "basic GUI internals")
+ NODE.NewFlag("NODE", false, full, short, "binary tree debugging")
+ PLUG.NewFlag("PLUG", false, full, short, "basic PLUG debuggging")
+ CHANGE.NewFlag("CHANGE", false, full, short, "user changed something")
}
diff --git a/debug.go b/debug.go
index 8da55b2..2d32fa7 100644
--- a/debug.go
+++ b/debug.go
@@ -86,9 +86,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(true, "parent =",n.parent.id, n.parent.Name)
- log.Log(true, "listChildrenParent =",listChildrenParent.id, listChildrenParent.Name)
- log.Log(true, listChildrenParent.id, "!=", n.parent.id)
+ log.Log(NOW, "parent =",n.parent.id, n.parent.Name)
+ log.Log(NOW, "listChildrenParent =",listChildrenParent.id, listChildrenParent.Name)
+ log.Log(NOW, listChildrenParent.id, "!=", n.parent.id)
log.Exit("parent.child does not match child.parent")
}
}
@@ -131,5 +131,5 @@ func logindent(b bool, depth int, format string, a ...any) {
// array prepend(). Why isn't this a standard function. It should be:
// a.prepend(debugGui, newFormat)
a = append([]any{b, newFormat}, a...)
- log.Log(b, a...)
+ log.Log(NOW, a...)
}
diff --git a/main.go b/main.go
index 19570d8..de7ed7c 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(true, "init() has been run")
+ log.Log(NOW, "init() has been run")
me.counter = 0
me.prefix = "wit"
@@ -155,10 +155,10 @@ func (n *Node) StandardClose() {
// The window is destroyed and the application exits
// TODO: properly exit the plugin since Quit() doesn't do it
func StandardExit() {
- log.Log(true, "wit/gui Standard Window Exit. running os.Exit()")
- log.Log(true, "StandardExit() attempt to exit each toolkit plugin")
+ log.Log(NOW, "wit/gui Standard Window Exit. running os.Exit()")
+ log.Log(NOW, "StandardExit() attempt to exit each toolkit plugin")
for i, plug := range allPlugins {
- log.Log(true, "NewButton()", i, plug)
+ log.Log(NOW, "NewButton()", i, plug)
}
log.Exit(0)
}
diff --git a/plugin.go b/plugin.go
index 2eff0aa..251f880 100644
--- a/plugin.go
+++ b/plugin.go
@@ -171,11 +171,11 @@ func searchPaths(name string) *aplug {
func initToolkit(name string, filename string) *aplug {
if _, err := os.Stat(filename); err != nil {
if os.IsNotExist(err) {
- log.Log(true, "missing plugin", name, "as filename", filename)
+ log.Log(PLUG, "missing plugin", name, "as filename", filename)
return nil
}
}
- log.Log(true, "Found plugin", name, "as filename", filename)
+ log.Log(PLUG, "Found plugin", name, "as filename", filename)
plug, err := plugin.Open(filename)
if err != nil {