From af6ed964ef540511b4982e50cee85e6fc9715763 Mon Sep 17 00:00:00 2001 From: Lynn Cyrin Date: Wed, 26 Jun 2019 20:48:04 -0700 Subject: [PATCH] len => RuneCount note: this is not currently easily testable without a larger diff that refactors the levels --- text_formatter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text_formatter.go b/text_formatter.go index a4b65e8..f08563e 100644 --- a/text_formatter.go +++ b/text_formatter.go @@ -10,6 +10,7 @@ import ( "strings" "sync" "time" + "unicode/utf8" ) const ( @@ -95,7 +96,7 @@ func (f *TextFormatter) init(entry *Entry) { } // Get the max length of the level text for _, level := range AllLevels { - levelTextLength := len(level.String()) + levelTextLength := utf8.RuneCount([]byte(level.String())) if levelTextLength > f.levelTextMaxLength { f.levelTextMaxLength = levelTextLength }