diff --git a/args.go b/args.go new file mode 100644 index 0000000..0c6e9e6 --- /dev/null +++ b/args.go @@ -0,0 +1,18 @@ +package gadgets + +// initializes logging and command line options + +import ( + "go.wit.com/log" +) + +var INFO log.LogFlag + +func init() { + INFO.B = false + INFO.Name = "INFO" + INFO.Subsystem = "gadgets" + INFO.Short = "gadgets" + INFO.Desc = "general info" + INFO.Register() +} diff --git a/basicCombobox.go b/basicCombobox.go index 1b60000..ed1f680 100644 --- a/basicCombobox.go +++ b/basicCombobox.go @@ -43,14 +43,14 @@ func (d *BasicCombobox) Ready() bool { func (d *BasicCombobox) Add(value string) { if ! d.Ready() {return} - log.Println("BasicCombobox.Add() =", value) + log.Log(INFO, "BasicCombobox.Add() =", value) d.d.AddDropdownName(value) return } func (d *BasicCombobox) Set(value string) bool { if ! d.Ready() {return false} - log.Println("BasicCombobox.Set() =", value) + log.Log(INFO, "BasicCombobox.Set() =", value) d.d.SetText(value) d.value = value return true @@ -68,7 +68,7 @@ func NewBasicCombobox(p *gui.Node, name string) *BasicCombobox { d.d = p.NewCombobox("") d.d.Custom = func() { d.value = d.Get() - log.Println("BasicCombobox.Custom() user changed value to =", d.value) + log.Log(INFO, "BasicCombobox.Custom() user changed value to =", d.value) if d.Custom != nil { d.Custom() } diff --git a/basicDropdown.go b/basicDropdown.go index 2279ee3..6e8888a 100644 --- a/basicDropdown.go +++ b/basicDropdown.go @@ -43,14 +43,14 @@ func (d *BasicDropdown) Ready() bool { func (d *BasicDropdown) Add(value string) { if ! d.Ready() {return} - log.Println("BasicDropdown.Set() =", value) + log.Log(INFO, "BasicDropdown.Set() =", value) d.d.AddDropdownName(value) return } func (d *BasicDropdown) Set(value string) bool { if ! d.Ready() {return false} - log.Println("BasicDropdown.Set() =", value) + log.Log(INFO, "BasicDropdown.Set() =", value) d.l.SetText(value) d.value = value return true @@ -68,7 +68,7 @@ func NewBasicDropdown(p *gui.Node, name string) *BasicDropdown { d.d = p.NewDropdown("") d.d.Custom = func() { d.value = d.Get() - log.Println("BasicDropdown.Custom() user changed value to =", d.value) + log.Log(INFO, "BasicDropdown.Custom() user changed value to =", d.value) if d.Custom != nil { d.Custom() } diff --git a/basicEntry.go b/basicEntry.go index e95d17d..0fe247f 100644 --- a/basicEntry.go +++ b/basicEntry.go @@ -30,7 +30,7 @@ func (n *BasicEntry) Get() string { } func (n *BasicEntry) Set(value string) *BasicEntry { - log.Println("BasicEntry.Set() =", value) + log.Log(INFO, "BasicEntry.Set() =", value) if (n.v != nil) { n.v.Set(value) } @@ -49,7 +49,7 @@ func NewBasicEntry(p *gui.Node, name string) *BasicEntry { d.v = p.NewEntryLine("") d.v.Custom = func() { d.value = d.v.S - log.Println("BasicEntry.Custom() user changed value to =", d.value) + log.Log(INFO, "BasicEntry.Custom() user changed value to =", d.value) } return &d diff --git a/basicLabel.go b/basicLabel.go index 1cd6d3a..6d87087 100644 --- a/basicLabel.go +++ b/basicLabel.go @@ -32,7 +32,7 @@ func (n *BasicLabel) Get() string { } func (n *BasicLabel) Set(value string) *BasicLabel { - log.Println("BasicLabel.Set() =", value) + log.Log(INFO, "BasicLabel.Set() =", value) if (n.v != nil) { n.v.Set(value) } @@ -53,7 +53,7 @@ func (ngui *Node) NewBasicLabel(name string) *BasicLabel { d.v = n.NewLabel("") d.v.Custom = func() { d.value = d.v.S - log.Println("BasicLabel.Custom() user changed value to =", d.value) + log.Log(INFO, "BasicLabel.Custom() user changed value to =", d.value) } return &d diff --git a/basicWindow.go b/basicWindow.go index 066ca65..2f34513 100644 --- a/basicWindow.go +++ b/basicWindow.go @@ -76,7 +76,7 @@ func (w *BasicWindow) Box() *gui.Node { } func (w *BasicWindow) Vertical() { - log.Warn("BasicWindow() w.vertical =", w.vertical) + log.Log(INFO, "BasicWindow() w.vertical =", w.vertical) if ! w.Initialized() { log.Warn("BasicWindow() not Initialized yet()") return @@ -86,7 +86,7 @@ func (w *BasicWindow) Vertical() { return } w.vertical = true - log.Warn("BasicWindow() w.vertical =", w.vertical) + log.Log(INFO, "BasicWindow() w.vertical =", w.vertical) } func (w *BasicWindow) Draw() { @@ -94,14 +94,14 @@ func (w *BasicWindow) Draw() { // various timeout settings w.win = w.parent.NewWindow(w.name) w.win.Custom = func() { - log.Println("BasicWindow.Custom() closed. TODO: handle this", w.name) + log.Warn("BasicWindow.Custom() closed. TODO: handle this", w.name) } if w.vertical { w.box = w.win.NewBox("bw vbox", false) - log.Warn("BasicWindow.Custom() made vbox") + log.Log(INFO, "BasicWindow.Custom() made vbox") } else { w.box = w.win.NewBox("bw hbox", true) - log.Warn("BasicWindow.Custom() made hbox") + log.Log(INFO, "BasicWindow.Custom() made hbox") } w.ready = true diff --git a/durationSlider.go b/durationSlider.go index 6ae1e00..97aeb53 100644 --- a/durationSlider.go +++ b/durationSlider.go @@ -5,10 +5,10 @@ package gadgets import ( - "log" "fmt" "time" + "go.wit.com/log" "go.wit.com/gui/gui" ) @@ -42,13 +42,13 @@ func (n *Duration) Set(d time.Duration) { timeRange = n.High - n.Low step = timeRange / 1000 if (step == 0) { - log.Println("duration.Set() division by step == 0", n.Low, n.High, timeRange, step) + log.Log(INFO, "duration.Set() division by step == 0", n.Low, n.High, timeRange, step) n.s.Set(0) return } offset = d - n.Low i := int(offset / step) - log.Println("duration.Set() =", n.Low, n.High, d, "i =", i) + log.Log(INFO, "duration.Set() =", n.Low, n.High, d, "i =", i) n.s.I = i n.s.Set(i) n.s.Custom() diff --git a/oneLiner.go b/oneLiner.go index faf0ece..5f186d3 100644 --- a/oneLiner.go +++ b/oneLiner.go @@ -30,7 +30,7 @@ func (n *OneLiner) Get() string { } func (n *OneLiner) Set(value string) *OneLiner { - log.Println("OneLiner.Set() =", value) + log.Log(INFO, "OneLiner.Set() =", value) if (n.v != nil) { n.v.Set(value) } @@ -49,7 +49,7 @@ func NewOneLiner(n *gui.Node, name string) *OneLiner { d.v = n.NewLabel("") d.v.Custom = func() { d.value = d.v.S - log.Println("OneLiner.Custom() user changed value to =", d.value) + log.Log(INFO, "OneLiner.Custom() user changed value to =", d.value) } return &d