diff --git a/addNode.go b/addNode.go index 26dc8d0..660ddae 100644 --- a/addNode.go +++ b/addNode.go @@ -18,7 +18,7 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node { n.Strings = make(map[string]int) if a.WidgetType == widget.Root { - log.Info("AddNode() Root") + log.Log(TREE, "AddNode() Root") n.Parent = n me.treeRoot = n return n @@ -40,8 +40,8 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node { log.Warn("AddNode() ERROR n.Parent == nil", a.WidgetId, a.ParentId, a.WidgetType) return n } - log.Warn("AddNode() Adding to parent =", p.ParentId, p.WidgetType, p.GetProgName()) - log.Warn("AddNode() Adding child =", n.ParentId, n.WidgetType, n.GetProgName()) + log.Log(TREE, "AddNode() Adding to parent =", p.ParentId, p.WidgetType, p.GetProgName()) + log.Log(TREE, "AddNode() Adding child =", n.ParentId, n.WidgetType, n.GetProgName()) p.children = append(p.children, n) return n } @@ -49,14 +49,14 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node { func (n *Node) DeleteNode() { p := n.Parent for i, child := range p.children { - log.Warn("parent has child:", i, child.WidgetId, child.GetProgName()) + log.Log(TREE, "parent has child:", i, child.WidgetId, child.GetProgName()) if n == child { - log.Warn("Found child ==", i, child.WidgetId, child.GetProgName()) - log.Warn("Found n ==", i, n.WidgetId, n.GetProgName()) + log.Log(TREE, "Found child ==", i, child.WidgetId, child.GetProgName()) + log.Log(TREE, "Found n ==", i, n.WidgetId, n.GetProgName()) p.children = append(p.children[:i], p.children[i+1:]...) } } for i, child := range p.children { - log.Warn("parent now has child:", i, child.WidgetId, child.GetProgName()) + log.Log(TREE, "parent now has child:", i, child.WidgetId, child.GetProgName()) } } diff --git a/event.go b/event.go index 8414c15..f23b920 100644 --- a/event.go +++ b/event.go @@ -51,9 +51,9 @@ func (me *TreeInfo) SendToolkitPanic() { var a widget.Action a.ActionType = widget.ToolkitPanic a.ProgName = me.PluginName - log.Info("SendUserEvent() START: toolkit panic()") + log.Log(TREE, "SendUserEvent() START: toolkit panic()") me.callback <- a - log.Info("SendUserEvent() END: toolkit panic()") + log.Log(TREE, "SendUserEvent() END: toolkit panic()") return } @@ -65,9 +65,9 @@ func (me *TreeInfo) SendWindowCloseEvent(n *Node) { var a widget.Action a.WidgetId = n.WidgetId a.ActionType = widget.CloseWindow - log.Info("SendUserEvent() START: user closed the window", n.GetProgName()) + log.Log(TREE, "SendUserEvent() START: user closed the window", n.GetProgName()) me.callback <- a - log.Info("SendUserEvent() END: user closed the window", n.GetProgName()) + log.Log(TREE, "SendUserEvent() END: user closed the window", n.GetProgName()) return } @@ -82,10 +82,10 @@ func (me *TreeInfo) SendUserEvent(n *Node) { a.Value = n.State.Value a.ActionType = widget.User if n.WidgetType == widget.Checkbox { - log.Info("SendUserEvent() checkbox going to send:", a.Value) + log.Log(TREE, "SendUserEvent() checkbox going to send:", a.Value) } - log.Info("SendUserEvent() START: send a user event to the callback channel") + log.Log(TREE, "SendUserEvent() START: send a user event to the callback channel") me.callback <- a - log.Info("SendUserEvent() END: sent a user event to the callback channel") + log.Log(TREE, "SendUserEvent() END: sent a user event to the callback channel") return } diff --git a/flags.go b/flags.go new file mode 100644 index 0000000..4e6fda4 --- /dev/null +++ b/flags.go @@ -0,0 +1,13 @@ +package tree + +import ( + "go.wit.com/log" +) + +var TREE *log.LogFlag + +func init() { + full := "go.wit.com/gui" + short := "tree" + TREE = log.NewFlag("TREE", false, full, short, "treeRoot info") +} diff --git a/init.go b/init.go index ba82b78..66dc673 100644 --- a/init.go +++ b/init.go @@ -18,9 +18,9 @@ func (me *TreeInfo) catchActionChannel() { panic(-1) } }() - log.Info("catchActionChannel() START") + log.Log(TREE, "catchActionChannel() START") for { - log.Info("catchActionChannel() for loop") + log.Log(TREE, "catchActionChannel() for loop") select { case a := <-me.pluginChan: log.Verbose("catchActionChannel() on ", a.WidgetId, a.WidgetType, a.ProgName) @@ -41,7 +41,7 @@ func (me *TreeInfo) catchActionChannel() { me.ActionFromChannel(a) } muAction.Unlock() - // log.Info("catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType) + // log.Log(TREE, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType) } } } @@ -50,8 +50,14 @@ func New() *TreeInfo { me := new(TreeInfo) me.pluginChan = make(chan widget.Action, 1) - log.Info("Init() start channel reciever") + /* + full := "go.wit.com/gui" + short := "gui" + TREE = log.NewFlag("TREE", true, full, short, "treeRoot info") + */ + + log.Log(TREE, "Init() start channel reciever") go me.catchActionChannel() - log.Info("Init() END") + log.Log(TREE, "Init() END") return me } diff --git a/json.go b/json.go index fb671af..5a52334 100644 --- a/json.go +++ b/json.go @@ -54,7 +54,7 @@ func (n *Node) Json() []string { log.Warn(tmp) return all default: - log.Info("doUserEvent() type =", n.WidgetType) + log.Log(TREE, "doUserEvent() type =", n.WidgetType) } return all }