From 5b39848b6448c8b95764bd42146e4e13b469876e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 31 Jan 2025 12:08:13 -0600 Subject: more helpful and easier to read debugging output --- debug.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'debug.go') diff --git a/debug.go b/debug.go index 7fa8561..3951147 100644 --- a/debug.go +++ b/debug.go @@ -8,9 +8,9 @@ import ( ) func (w *guiWidget) dumpTree(s string) { - // log.Log(ERROR, "dumpTree w", w.node.WidgetId, w.WidgetType, w.String()) + // log.Log(ERROR, "dump w", w.node.WidgetId, w.WidgetType, w.String()) if w == nil { - log.Log(ERROR, "dumpTree w.TK == nil", w.node.WidgetId, w.WidgetType, w.String()) + log.Log(ERROR, "dump w.TK == nil", w.node.WidgetId, w.WidgetType, w.String()) return } w.showWidgetPlacement("dumpTree() " + s) @@ -29,27 +29,29 @@ func (w *guiWidget) showWidgetPlacement(s string) { } else { pId = w.node.Parent.WidgetId } - s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.node.WidgetId, pId) + s1 = fmt.Sprintf("(wId,pId)=(%4d,%4d) ", w.node.WidgetId, pId) sizeW, sizeH := w.Size() - s1 += fmt.Sprintf("size=(%2d,%2d)", sizeW, sizeH) + s1 += fmt.Sprintf("size=(%3d,%3d)", sizeW, sizeH) if w.Visible() { - s1 += fmt.Sprintf("gocui=(%2d,%2d,%2d,%2d)", + s1 += fmt.Sprintf("gocui=(%3d,%3d,%3d,%3d)", w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1) } else { - s1 += fmt.Sprintf(" %2s %2s %2s %2s ", "", "", "", "") + s1 += fmt.Sprintf(" %3s %3s %3s %3s ", "", "", "", "") } if w.node.Parent != nil { if w.node.Parent.WidgetType == widget.Grid { - s1 += fmt.Sprintf("At(%2d,%2d) ", w.node.State.AtW, w.node.State.AtH) + s1 += fmt.Sprintf("At(%3d,%3d) ", w.node.State.AtW, w.node.State.AtH) } else { - s1 += fmt.Sprintf(" %2s %2s ", "", "") + s1 += fmt.Sprintf(" %3s %3s ", "", "") } } else { - s1 += fmt.Sprintf(" %2s %2s ", "", "") + s1 += fmt.Sprintf(" %3s %3s ", "", "") } - tmp := "." + w.String() + ". " + w.cuiName + var end string if w.node.WidgetType == widget.Box { - tmp = "." + w.node.State.Direction.String() + ". " + w.cuiName + end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.node.State.Direction.String()) + } else { + end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.String()) } - log.Log(NOW, s1, s, w.node.WidgetType, ",", tmp) // + log.Log(NOW, s1, s, end) } -- cgit v1.2.3