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 INFO log.LogFlag
var NOW log.LogFlag
var GUI log.LogFlag var GUI log.LogFlag
var NODE log.LogFlag var NODE log.LogFlag
var PLUG log.LogFlag var PLUG log.LogFlag
@ -28,33 +28,13 @@ func ArgToolkit() string {
func init() { func init() {
arg.Register(&argGui) arg.Register(&argGui)
INFO.B = false full := "go.wit.com/gui/gui"
INFO.Name = "INFO" short := "gui"
INFO.Subsystem = "gui"
INFO.Desc = "Enable log.Info()"
INFO.Register()
GUI.B = false NOW.NewFlag("NOW", true, full, short, "temp debugging stuff")
GUI.Name = "GUI" INFO.NewFlag("INFO", false, full, short, "General Info")
GUI.Subsystem = "gui" GUI.NewFlag("GUI", false, full, short, "basic GUI internals")
GUI.Desc = "basic GUI debugging" NODE.NewFlag("NODE", false, full, short, "binary tree debugging")
GUI.Register() PLUG.NewFlag("PLUG", false, full, short, "basic PLUG debuggging")
CHANGE.NewFlag("CHANGE", false, full, short, "user changed something")
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()
} }

View File

@ -86,9 +86,9 @@ func (n *Node) ListChildren(dump bool) {
if (listChildrenParent != nil) { if (listChildrenParent != nil) {
log.Log(NODE, "\t\t\tlistChildrenParent =",listChildrenParent.id) log.Log(NODE, "\t\t\tlistChildrenParent =",listChildrenParent.id)
if (listChildrenParent.id != n.parent.id) { if (listChildrenParent.id != n.parent.id) {
log.Log(true, "parent =",n.parent.id, n.parent.Name) log.Log(NOW, "parent =",n.parent.id, n.parent.Name)
log.Log(true, "listChildrenParent =",listChildrenParent.id, listChildrenParent.Name) log.Log(NOW, "listChildrenParent =",listChildrenParent.id, listChildrenParent.Name)
log.Log(true, listChildrenParent.id, "!=", n.parent.id) log.Log(NOW, listChildrenParent.id, "!=", n.parent.id)
log.Exit("parent.child does not match child.parent") 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: // array prepend(). Why isn't this a standard function. It should be:
// a.prepend(debugGui, newFormat) // a.prepend(debugGui, newFormat)
a = append([]any{b, newFormat}, a...) 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 const Yaxis = 1 // stack things vertically
func init() { func init() {
log.Log(true, "init() has been run") log.Log(NOW, "init() has been run")
me.counter = 0 me.counter = 0
me.prefix = "wit" me.prefix = "wit"
@ -155,10 +155,10 @@ func (n *Node) StandardClose() {
// The window is destroyed and the application exits // The window is destroyed and the application exits
// TODO: properly exit the plugin since Quit() doesn't do it // TODO: properly exit the plugin since Quit() doesn't do it
func StandardExit() { func StandardExit() {
log.Log(true, "wit/gui Standard Window Exit. running os.Exit()") log.Log(NOW, "wit/gui Standard Window Exit. running os.Exit()")
log.Log(true, "StandardExit() attempt to exit each toolkit plugin") log.Log(NOW, "StandardExit() attempt to exit each toolkit plugin")
for i, plug := range allPlugins { for i, plug := range allPlugins {
log.Log(true, "NewButton()", i, plug) log.Log(NOW, "NewButton()", i, plug)
} }
log.Exit(0) log.Exit(0)
} }

View File

@ -171,11 +171,11 @@ func searchPaths(name string) *aplug {
func initToolkit(name string, filename string) *aplug { func initToolkit(name string, filename string) *aplug {
if _, err := os.Stat(filename); err != nil { if _, err := os.Stat(filename); err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
log.Log(true, "missing plugin", name, "as filename", filename) log.Log(PLUG, "missing plugin", name, "as filename", filename)
return nil 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) plug, err := plugin.Open(filename)
if err != nil { if err != nil {