Merge pull request #11694 from ilya-zuyev/fix_box_intersection

Fix intersected log boxes when running with --alsologtostderr
pull/11709/head
Medya Ghazizadeh 2021-06-21 12:36:01 -04:00 committed by GitHub
commit f068befb3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -114,17 +114,12 @@ func Styled(st style.Enum, format string, a ...V) {
}
func boxedCommon(printFunc func(format string, a ...interface{}), format string, a ...V) {
str := Sprintf(style.None, format, a...)
str = strings.TrimSpace(str)
box := box.New(box.Config{Py: 1, Px: 4, Type: "Round"})
if useColor {
box.Config.Color = "Red"
}
str = box.String("", str)
lines := strings.Split(str, "\n")
for _, line := range lines {
printFunc(line + "\n")
}
str := Sprintf(style.None, format, a...)
printFunc(box.String("", strings.TrimSpace(str)))
}
// Boxed writes a stylized and templated message in a box to stdout