Skip to content

Commit

Permalink
Add repeat count debug
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidaguerre committed Aug 4, 2021
1 parent c1409de commit 604c91b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions control/controldisplay/group_counter_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"math"
"runtime/debug"
"strings"
)

Expand Down Expand Up @@ -61,6 +62,23 @@ func (r CounterGraphRenderer) Render() string {
}

func (r CounterGraphRenderer) buildGraphString(failSegments int, passSegments int, spaces int) string {
failSegments = -1
if failSegments < 0 {
log.Printf("[WARN] buildGraphString negative repeat count: failSegments %d, passSegments %d, spaces %d", failSegments, passSegments, spaces)
failSegments = 0
debug.PrintStack()
}
if passSegments < 0 {
log.Printf("[WARN] buildGraphString negative repeat count: failSegments %d, passSegments %d, spaces %d", failSegments, passSegments, spaces)
passSegments = 0
debug.PrintStack()
}
if spaces < 0 {
log.Printf("[WARN] buildGraphString negative repeat count: failSegments %d, passSegments %d, spaces %d", failSegments, passSegments, spaces)
spaces = 0
debug.PrintStack()
}

str := fmt.Sprintf("%s%s%s%s%s",
ControlColors.CountGraphBracket("["),
ControlColors.CountGraphFail(strings.Repeat("=", failSegments)),
Expand Down

0 comments on commit 604c91b

Please sign in to comment.