Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/ooniprobe/internal/log/handlers/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func logSectionTitle(w io.Writer, f log.Fields) error {
colWidth := 24

title := f.Get("title").(string)
fmt.Fprintf(w, "┏"+strings.Repeat("━", colWidth+2)+"┓\n")
fmt.Fprintf(w, "┏%s┓\n", strings.Repeat("━", colWidth+2))
fmt.Fprintf(w, "┃ %s ┃\n", utils.RightPad(title, colWidth))
fmt.Fprintf(w, "┗"+strings.Repeat("━", colWidth+2)+"┛\n")
fmt.Fprintf(w, "┗%s┛\n", strings.Repeat("━", colWidth+2))
return nil
}

Expand All @@ -91,13 +91,13 @@ func logTable(w io.Writer, f log.Fields) error {
}
}

fmt.Fprintf(w, "┏"+strings.Repeat("━", colWidth+2)+"┓\n")
fmt.Fprintf(w, "┏%s┓\n", strings.Repeat("━", colWidth+2))
for _, line := range lines {
fmt.Fprintf(w, "┃ %s ┃\n",
utils.RightPad(line, colWidth),
)
}
fmt.Fprintf(w, "┗"+strings.Repeat("━", colWidth+2)+"┛\n")
fmt.Fprintf(w, "┗%s┛\n", strings.Repeat("━", colWidth+2))
return nil
}

Expand Down
14 changes: 7 additions & 7 deletions cmd/ooniprobe/internal/log/handlers/cli/measurements.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func logTestKeys(w io.Writer, testKeys string) error {
testKeysLines[len(testKeysLines)-1] = testKeysLines[len(testKeysLines)-1] + "}"
}
for _, line := range testKeysLines {
fmt.Fprintf(w, fmt.Sprintf("│ %s │\n",
fmt.Fprintf(w, "%s", fmt.Sprintf("│ %s │\n",
utils.RightPad(line, colWidth*2)))
}
return nil
Expand All @@ -61,30 +61,30 @@ func logMeasurementItem(w io.Writer, f log.Fields) error {
isFirst := f.Get("is_first").(bool)
isLast := f.Get("is_last").(bool)
if isFirst {
fmt.Fprintf(w, "┏"+strings.Repeat("━", colWidth*2+2)+"┓\n")
fmt.Fprintf(w, "┏%s┓\n", strings.Repeat("━", colWidth*2+2))
} else {
fmt.Fprintf(w, "┢"+strings.Repeat("━", colWidth*2+2)+"┪\n")
fmt.Fprintf(w, "┢%s┪\n", strings.Repeat("━", colWidth*2+2))
}

anomalyStr := fmt.Sprintf("ok: %s", statusIcon(!isAnomaly))
uploadStr := fmt.Sprintf("uploaded: %s", statusIcon(isUploaded))
failureStr := fmt.Sprintf("success: %s", statusIcon(!isFailed))

fmt.Fprintf(w, fmt.Sprintf("│ %s │\n",
fmt.Fprintf(w, "%s", fmt.Sprintf("│ %s │\n",
utils.RightPad(
fmt.Sprintf("#%d", rID), colWidth*2)))

if url != "" {
fmt.Fprintf(w, fmt.Sprintf("│ %s │\n",
fmt.Fprintf(w, "%s", fmt.Sprintf("│ %s │\n",
utils.RightPad(
fmt.Sprintf("%s (%s)", url, urlCategoryCode), colWidth*2)))
}

fmt.Fprintf(w, fmt.Sprintf("│ %s %s│\n",
fmt.Fprintf(w, "%s", fmt.Sprintf("│ %s %s│\n",
utils.RightPad(testName, colWidth),
utils.RightPad(anomalyStr, colWidth)))

fmt.Fprintf(w, fmt.Sprintf("│ %s %s│\n",
fmt.Fprintf(w, "%s", fmt.Sprintf("│ %s %s│\n",
utils.RightPad(failureStr, colWidth),
utils.RightPad(uploadStr, colWidth)))

Expand Down
14 changes: 7 additions & 7 deletions cmd/ooniprobe/internal/log/handlers/cli/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,27 @@ func logResultItem(w io.Writer, f log.Fields) error {
index := f.Get("index").(int)
totalCount := f.Get("total_count").(int)
if index == 0 {
fmt.Fprintf(w, "┏"+strings.Repeat("━", colWidth*2+2)+"┓\n")
fmt.Fprintf(w, "┏%s┓\n", strings.Repeat("━", colWidth*2+2))
} else {
fmt.Fprintf(w, "┢"+strings.Repeat("━", colWidth*2+2)+"┪\n")
fmt.Fprintf(w, "┢%s┪\n", strings.Repeat("━", colWidth*2+2))
}

firstRow := utils.RightPad(fmt.Sprintf("#%d - %s", rID, startTime.Format(time.RFC822)), colWidth*2)
fmt.Fprintf(w, "┃ "+firstRow+" ┃\n")
fmt.Fprintf(w, "┡"+strings.Repeat("━", colWidth*2+2)+"┩\n")
fmt.Fprintf(w, "┃ %s ┃\n", firstRow)
fmt.Fprintf(w, "┡%s┩\n",strings.Repeat("━", colWidth*2+2))

summary := makeSummary(name,
f.Get("measurement_count").(uint64),
f.Get("measurement_anomaly_count").(uint64),
f.Get("test_keys").(string))

fmt.Fprintf(w, fmt.Sprintf("│ %s %s│\n",
fmt.Fprintf(w, "%s", fmt.Sprintf("│ %s %s│\n",
utils.RightPad(name, colWidth),
utils.RightPad(summary[0], colWidth)))
fmt.Fprintf(w, fmt.Sprintf("│ %s %s│\n",
fmt.Fprintf(w, "%s", fmt.Sprintf("│ %s %s│\n",
utils.RightPad(networkName, colWidth),
utils.RightPad(summary[1], colWidth)))
fmt.Fprintf(w, fmt.Sprintf("│ %s %s│\n",
fmt.Fprintf(w, "%s", fmt.Sprintf("│ %s %s│\n",
utils.RightPad(asn, colWidth),
utils.RightPad(summary[2], colWidth)))

Expand Down
Loading