loggging output cleanups

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-21 11:42:31 -06:00
parent 50074e543b
commit 5eea7f5059
11 changed files with 45 additions and 62 deletions

View File

@ -6,11 +6,11 @@ import (
"go.wit.com/log"
)
var INFO *log.LogFlag
var GADGETS *log.LogFlag
func init() {
full := "go.wit.com/gui/gadget"
full := "go.wit.com/gui"
short := "gadgets"
INFO = log.NewFlag("INFO", false, full, short, "General Info")
GADGETS = log.NewFlag("GADGETS", false, full, short, "General Info")
}

View File

@ -82,7 +82,7 @@ func (d *BasicCombobox) AddText(s string) {
if !d.Ready() {
return
}
log.Log(INFO, "BasicCombobox.Add() =", s)
log.Log(GADGETS, "BasicCombobox.Add() =", s)
d.d.AddText(s)
}
@ -96,7 +96,7 @@ func NewBasicCombobox(p *gui.Node, label string) *BasicCombobox {
d.l = p.NewLabel(label)
d.d = p.NewCombobox()
d.d.Custom = func() {
log.Warn("BasicCombobox.Custom() user changed value to =", d.String())
log.Log(GADGETS, "BasicCombobox.Custom() user changed value to =", d.String())
if d.Custom != nil {
d.Custom()
}

View File

@ -49,7 +49,7 @@ func (d *BasicDropdown) AddText(s string) {
if !d.Ready() {
return
}
log.Log(INFO, "BasicDropdown.AddText() =", s)
log.Log(GADGETS, "BasicDropdown.AddText() =", s)
d.d.AddText(s)
return
}
@ -58,7 +58,7 @@ func (d *BasicDropdown) SetText(s string) {
if !d.Ready() {
return
}
log.Log(INFO, "BasicDropdown.SetText() =", s)
log.Log(GADGETS, "BasicDropdown.SetText() =", s)
d.d.SetText(s)
return
}
@ -67,7 +67,7 @@ func (d *BasicDropdown) String() string {
if !d.Ready() {
return ""
}
log.Log(INFO, "BasicDropdown.String()", d.d.String())
log.Log(GADGETS, "BasicDropdown.String()", d.d.String())
return d.d.String()
}
@ -75,7 +75,7 @@ func (d *BasicDropdown) SetLabel(value string) bool {
if !d.Ready() {
return false
}
log.Log(INFO, "BasicDropdown.SetLabel() =", value)
log.Log(GADGETS, "BasicDropdown.SetLabel() =", value)
d.l.SetText(value)
return true
}
@ -83,7 +83,7 @@ func (d *BasicDropdown) SetLabel(value string) bool {
/*
func (d *BasicDropdown) Set(value string) bool {
if ! d.Ready() {return false}
log.Log(INFO, "BasicDropdown.Set() =", value)
log.Log(GADGETS, "BasicDropdown.Set() =", value)
d.d.SetText(value)
d.value = value
return true
@ -102,7 +102,7 @@ func NewBasicDropdown(p *gui.Node, name string) *BasicDropdown {
d.d = p.NewDropdown()
d.d.Custom = func() {
d.value = d.d.String()
log.Log(INFO, "BasicDropdown.Custom() user changed value to =", d.value)
log.Log(GADGETS, "BasicDropdown.Custom() user changed value to =", d.value)
if d.Custom != nil {
d.Custom()
}

View File

@ -23,23 +23,23 @@ type BasicEntry struct {
}
func (n *BasicEntry) SetText(s string) *BasicEntry {
log.Log(INFO, "BasicEntry.Set() =", s)
log.Log(GADGETS, "BasicEntry.Set() =", s)
n.v.SetText(s)
return n
}
func (n *BasicEntry) Enable() {
log.Log(INFO, "BasicEntry.Enable()")
log.Log(GADGETS, "BasicEntry.Enable()")
n.v.Enable()
}
func (n *BasicEntry) Disable() {
log.Log(INFO, "BasicEntry.Disable()")
log.Log(GADGETS, "BasicEntry.Disable()")
n.v.Disable()
}
func (n *BasicEntry) String() string {
log.Log(INFO, "BasicEntry.SetLabel() =", n.v.String())
log.Log(GADGETS, "BasicEntry.SetLabel() =", n.v.String())
return n.v.String()
}
@ -57,7 +57,7 @@ func NewBasicEntry(p *gui.Node, name string) *BasicEntry {
d.l = p.NewLabel(name)
d.v = p.NewEntryLine("")
d.v.Custom = func() {
log.Log(INFO, "BasicEntry() user changed =", d.String())
log.Log(GADGETS, "BasicEntry() user changed =", d.String())
if d.Custom != nil {
d.Custom()
}

View File

@ -33,7 +33,7 @@ func (n *BasicLabel) Get() string {
}
func (n *BasicLabel) Set(value string) *BasicLabel {
log.Log(INFO, "BasicLabel.Set() =", value)
log.Log(GADGETS, "BasicLabel.Set() =", value)
if (n.v != nil) {
n.v.Set(value)
}
@ -55,7 +55,7 @@ func (ngui *Node) NewBasicLabel(name string) *BasicLabel {
d.v = n.NewLabel("")
d.v.Custom = func() {
d.value = d.v.String()
log.Log(INFO, "BasicLabel.Custom() user changed value to =", d.value)
log.Log(GADGETS, "BasicLabel.Custom() user changed value to =", d.value)
}
return &d

View File

@ -28,7 +28,7 @@ func NewBasicWindow(parent *gui.Node, title string) *BasicWindow {
title: title,
vertical: false,
}
log.Warn("NewBasicWindow() END")
log.Log(GADGETS, "NewBasicWindow() END")
return w
}
@ -46,7 +46,7 @@ func (w *BasicWindow) Hide() {
if !w.Ready() {
return
}
log.Warn("BasicWindow.Hide() here")
log.Log(GADGETS, "BasicWindow.Hide() here")
w.win.Hide()
w.hidden = true
return
@ -93,17 +93,6 @@ func (w *BasicWindow) StandardClose() {
return
}
w.win.Custom = w.win.StandardClose
/*
log.Warn("BasicWindow.Custom() closed. TODO: handle this", w.title)
log.Warn("BasicWindow.Custom() closed. handled properly?", w.title)
if w.Custom != nil {
log.Warn("BasicWindow.Custom() HAS CUSTOM")
w.Custom()
return
}
w.win.StandardExit()
}
*/
return
}
@ -113,10 +102,9 @@ func (w *BasicWindow) StandardExit() {
return
}
w.win.Custom = func() {
log.Warn("BasicWindow.Custom() closed. TODO: handle this", w.title)
log.Warn("BasicWindow.Custom() closed. handled properly?", w.title)
log.Log(GADGETS, "BasicWindow.Custom() closed. handled properly?", w.title)
if w.Custom != nil {
log.Warn("BasicWindow.Custom() HAS CUSTOM")
log.Log(GADGETS, "BasicWindow.Custom() HAS CUSTOM")
w.Custom()
return
}
@ -155,26 +143,26 @@ func (w *BasicWindow) Box() *gui.Node {
}
func (w *BasicWindow) Vertical() {
log.Warn("BasicWindow() Vertical() START w.vertical =", w.vertical, w.title)
log.Log(GADGETS, "BasicWindow() Vertical() START w.vertical =", w.vertical, w.title)
if w == nil {
return
}
w.vertical = true
log.Warn("BasicWindow() Vertical() END w.vertical =", w.vertical, w.title)
log.Log(GADGETS, "BasicWindow() Vertical() END w.vertical =", w.vertical, w.title)
}
func (w *BasicWindow) Horizontal() {
log.Warn("BasicWindow() Horizontal() START w.vertical =", w.vertical, w.title)
log.Log(GADGETS, "BasicWindow() Horizontal() START w.vertical =", w.vertical, w.title)
if w == nil {
return
}
w.vertical = false
log.Warn("BasicWindow() Horizontal() END w.vertical =", w.vertical, w.title)
log.Log(GADGETS, "BasicWindow() Horizontal() END w.vertical =", w.vertical, w.title)
}
func (w *BasicWindow) Make() {
if w.win != nil {
log.Warn("BasicWindow.Make() window was already created")
log.Log(GADGETS, "BasicWindow.Make() window was already created")
return
}
w.win = w.parent.RawWindow(w.title)
@ -185,8 +173,7 @@ func (w *BasicWindow) Make() {
// I like to call this Sierpinski mode
if w.win.Custom == nil {
w.win.Custom = func() {
log.Warn("BasicWindow.Custom() closed. TODO: handle this", w.title)
log.Warn("BasicWindow.Custom() closed. handled properly?", w.title)
log.Log(GADGETS, "BasicWindow.Custom() closed. handled properly?", w.title)
if w.Custom != nil {
w.Custom()
}
@ -194,10 +181,10 @@ func (w *BasicWindow) Make() {
}
if w.vertical {
w.box = w.win.NewVerticalBox("BW VBOX")
log.Log(INFO, "BasicWindow.Make() made NewVerticalBox", w.title)
log.Log(GADGETS, "BasicWindow.Make() made NewVerticalBox", w.title)
} else {
w.box = w.win.NewHorizontalBox("BW HBOX")
log.Log(INFO, "BasicWindow.Make() made NewHorizontalBox", w.title)
log.Log(GADGETS, "BasicWindow.Make() made NewHorizontalBox", w.title)
}
w.win.SetVisable(false)
@ -209,16 +196,16 @@ func (w *BasicWindow) TestDraw() {
return
}
if w.win == nil {
log.Warn("BasicWindow.TestDraw() can't draw on window == nil")
log.Log(GADGETS, "BasicWindow.TestDraw() can't draw on window == nil")
w.Make()
}
log.Warn("BasicWindow.TestDraw() RUNNING HERE")
log.Log(GADGETS, "BasicWindow.TestDraw() RUNNING HERE")
w.win.TestDraw()
}
func (w *BasicWindow) Draw() {
if w.win == nil {
log.Warn("BasicWindow.Draw() needs Make()")
log.Log(GADGETS, "BasicWindow.Draw() needs Make()")
w.Make()
}
w.win.TestDraw()

View File

@ -42,13 +42,13 @@ func (n *Duration) Set(d time.Duration) {
timeRange = n.High - n.Low
step = timeRange / 1000
if step == 0 {
log.Log(INFO, "duration.Set() division by step == 0", n.Low, n.High, timeRange, step)
log.Log(GADGETS, "duration.Set() division by step == 0", n.Low, n.High, timeRange, step)
n.s.SetValue(0)
return
}
offset = d - n.Low
i := int(offset / step)
log.Log(INFO, "duration.Set() =", n.Low, n.High, d, "i =", i)
log.Log(GADGETS, "duration.Set() =", n.Low, n.High, d, "i =", i)
// n.s.I = i
n.s.SetValue(i)
n.s.Custom()

2
go.mod
View File

@ -3,7 +3,7 @@ module go.wit.com/lib/gadgets
go 1.21.4
require (
go.wit.com/gui v0.12.19
go.wit.com/gui v0.12.20
go.wit.com/log v0.5.6
)

8
go.sum
View File

@ -4,13 +4,9 @@ go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
go.wit.com/gui v0.12.18 h1:gFVDaJFz/Su8JgUd9Oxnb3t+FS+bzy5WJSvGoKVGYZU=
go.wit.com/gui v0.12.18/go.mod h1:27+THr2a84GZ61KKUuN30WYnYoSsBewllUKc+fnWLto=
go.wit.com/gui v0.12.19 h1:OEnsnZnec7Q2jZVjwl413V0wuVAAB4r2mGTY0IouBuw=
go.wit.com/gui v0.12.19/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA=
go.wit.com/gui v0.12.20 h1:mIc2DKGcpQjZdgtAj5qzkBrBDiteWfIaEpLyMnIBkh8=
go.wit.com/gui v0.12.20/go.mod h1:v2VgnOL3dlZ13KclYeedZ1cd20nQdvwjyJTNKvFX3DA=
go.wit.com/log v0.5.6 h1:rDC3ju95zfEads4f1Zm+QMkqjZ39CsYAT/UmQQs7VP4=
go.wit.com/log v0.5.6/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
go.wit.com/widget v1.1.5 h1:jx5hJ2WLZJnCcvMuaLHegzpNlzwo+0kOkzsRkzRiB30=
go.wit.com/widget v1.1.5/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=
go.wit.com/widget v1.1.6 h1:av2miF5vlohMfARA/QGPTPfgW/ADup1c+oeAOKgroPY=
go.wit.com/widget v1.1.6/go.mod h1:I8tnD3x3ECbB/CRNnLCdC+uoyk7rK0AEkzK1bQYSqoQ=

View File

@ -57,10 +57,10 @@ func (f *LogFlag) GetDesc() string {
}
func (f *LogFlag) SetValue(b bool) {
log.Info("LogFlag.SetValue() before SetValue() log.flag =", f.lf.Bool(), "checkbox =", f.checkbox.Bool())
log.Log(GADGETS, "LogFlag.SetValue() before SetValue() log.flag =", f.lf.Bool(), "checkbox =", f.checkbox.Bool())
f.checkbox.SetChecked(b)
f.lf.SetBool(b)
log.Info("LogFlag.SetValue() after SetValue() log.flag =", f.lf.Bool(), "checkbox =", f.checkbox.Bool())
log.Log(GADGETS, "LogFlag.SetValue() after SetValue() log.flag =", f.lf.Bool(), "checkbox =", f.checkbox.Bool())
}
// should be RestoreDefault() ?

View File

@ -27,24 +27,24 @@ func (n *OneLiner) String() string {
}
func (n *OneLiner) SetValue(s string) *OneLiner {
log.Warn("OneLiner.Set() =", s)
log.Log(GADGETS, "OneLiner.Set() =", s)
n.v.SetLabel(s)
return n
}
func (n *OneLiner) SetLabel(value string) *OneLiner {
log.Log(INFO, "OneLiner.SetLabel() =", value)
log.Log(GADGETS, "OneLiner.SetLabel() =", value)
n.l.SetLabel(value)
return n
}
func (n *OneLiner) Enable() {
log.Log(INFO, "OneLiner.Enable()")
log.Log(GADGETS, "OneLiner.Enable()")
n.v.Show()
}
func (n *OneLiner) Disable() {
log.Log(INFO, "OneLiner.Disable()")
log.Log(GADGETS, "OneLiner.Disable()")
n.v.Hide()
}
@ -57,7 +57,7 @@ func NewOneLiner(n *gui.Node, label string) *OneLiner {
d.l = n.NewLabel(label)
d.v = n.NewLabel("")
d.v.Custom = func() {
log.Log(INFO, "OneLiner.Custom() user changed value to =", d.v.String())
log.Log(GADGETS, "OneLiner.Custom() user changed value to =", d.v.String())
}
return &d