go.wit.com/log Flags change

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-08 22:27:17 -06:00
parent b822af60b2
commit f287eb8185
4 changed files with 19 additions and 39 deletions

38
args.go
View File

@ -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()
full := "go.wit.com/gui/gui"
short := "gui"
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()
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")
}

View File

@ -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...)
}

View File

@ -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)
}

View File

@ -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 {