summaryrefslogtreecommitdiff
path: root/andlabs/debug.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-08 21:19:42 -0600
committerJeff Carr <[email protected]>2024-01-08 21:19:42 -0600
commit02d1d9e50cab6cde6d2096efdd94756b0ba37ec6 (patch)
tree806b141c91fb2bc69cdeb8efe58b2965f4f592b0 /andlabs/debug.go
parent3c2da3f096a5e8aeaa657deb2dc047cc23118c99 (diff)
moved to 'go.wit.com/log'
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'andlabs/debug.go')
-rw-r--r--andlabs/debug.go83
1 files changed, 19 insertions, 64 deletions
diff --git a/andlabs/debug.go b/andlabs/debug.go
index d92739f..96640a4 100644
--- a/andlabs/debug.go
+++ b/andlabs/debug.go
@@ -2,7 +2,9 @@ package main
import (
"strconv"
- "go.wit.com/gui/widget"
+
+ "go.wit.com/log"
+ // "go.wit.com/gui/widget"
)
var defaultBehavior bool = true
@@ -27,8 +29,8 @@ var debugError bool = true
func setDefaultBehavior(s bool) {
defaultBehavior = s
if (defaultBehavior) {
- log(debugToolkit, "Setting this toolkit to use the default behavior.")
- log(debugToolkit, "This is the 'guessing' part as defined by the wit/gui 'Principles'. Refer to the docs.")
+ log.Log(NOW, "Setting this toolkit to use the default behavior.")
+ log.Log(NOW, "This is the 'guessing' part as defined by the wit/gui 'Principles'. Refer to the docs.")
stretchy = false
padded = true
menubar = true
@@ -36,53 +38,44 @@ func setDefaultBehavior(s bool) {
canvas = false
bookshelf = true // 99% of the time, things make a vertical stack of objects
} else {
- log(debugToolkit, "This toolkit is set to ignore the default behavior.")
+ log.Log(NOW, "This toolkit is set to ignore the default behavior.")
}
}
-func ShowDebug () {
- log(true, "debugToolkit =", debugToolkit)
- log(true, "debugChange =", debugChange)
- log(true, "debugAction =", debugPlugin)
- log(true, "debugFlags =", debugFlags)
- log(true, "debugNow =", debugNow)
- log(true, "debugError =", debugError)
-}
-
func (t *guiWidget) Dump(b bool) {
if ! b {
return
}
- log(b, "Name = ", t.Width, t.Height)
+ log.Log(NOW, "Name = ", t.Width, t.Height)
if (t.uiBox != nil) {
- log(b, "uiBox =", t.uiBox)
+ log.Log(NOW, "uiBox =", t.uiBox)
}
if (t.uiButton != nil) {
- log(b, "uiButton =", t.uiButton)
+ log.Log(NOW, "uiButton =", t.uiButton)
}
if (t.uiCombobox != nil) {
- log(b, "uiCombobox =", t.uiCombobox)
+ log.Log(NOW, "uiCombobox =", t.uiCombobox)
}
if (t.uiWindow != nil) {
- log(b, "uiWindow =", t.uiWindow)
+ log.Log(NOW, "uiWindow =", t.uiWindow)
}
if (t.uiTab != nil) {
- log(b, "uiTab =", t.uiTab)
+ log.Log(NOW, "uiTab =", t.uiTab)
}
if (t.uiGroup != nil) {
- log(b, "uiGroup =", t.uiGroup)
+ log.Log(NOW, "uiGroup =", t.uiGroup)
}
if (t.uiEntry != nil) {
- log(b, "uiEntry =", t.uiEntry)
+ log.Log(NOW, "uiEntry =", t.uiEntry)
}
if (t.uiMultilineEntry != nil) {
- log(b, "uiMultilineEntry =", t.uiMultilineEntry)
+ log.Log(NOW, "uiMultilineEntry =", t.uiMultilineEntry)
}
if (t.uiSlider != nil) {
- log(b, "uiSlider =", t.uiSlider)
+ log.Log(NOW, "uiSlider =", t.uiSlider)
}
if (t.uiCheckbox != nil) {
- log(b, "uiCheckbox =", t.uiCheckbox)
+ log.Log(NOW, "uiCheckbox =", t.uiCheckbox)
}
}
@@ -92,49 +85,11 @@ func GetDebugToolkit () bool {
}
*/
-func flag(a *widget.Action) {
- // should set the checkbox to this value
- switch a.S {
- case "Quiet":
- logInfo = a.B
- logVerbose = a.B
- logWarn = a.B
- logError = a.B
- case "Error":
- logError = a.B
- case "Info":
- logInfo = a.B
- case "Verbose":
- logInfo = a.B
- logVerbose = a.B
- logWarn = a.B
- logError = a.B
- debugToolkit = a.B
- debugChange = a.B
- debugPlugin = a.B
- debugFlags = a.B
- case "Toolkit":
- debugToolkit = a.B
- case "Change":
- debugChange = a.B
- case "Plugin":
- debugPlugin = a.B
- case "Flags":
- debugFlags = a.B
- case "Now":
- debugNow = a.B
- case "Show":
- ShowDebug()
- default:
- log(debugError, "Can't set unknown flag", a.S)
- }
-}
-
func (n *node) dumpWidget(b bool) {
var info, d string
if (n == nil) {
- log(debugError, "dumpWidget() node == nil")
+ log.Log(ERROR, "dumpWidget() node == nil")
return
}
info = n.WidgetType.String()
@@ -145,7 +100,7 @@ func (n *node) dumpWidget(b bool) {
for i := 0; i < listChildrenDepth; i++ {
tabs = tabs + defaultPadding
}
- log(b, tabs + d)
+ log.Log(NOW, tabs + d)
}
var defaultPadding string = " "