Przeglądaj źródła

len => RuneCount

note: this is not currently easily testable without a larger diff that refactors the levels
pull/977/head
Lynn Cyrin 4 miesięcy temu
rodzic
commit
af6ed964ef
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2
    1
      text_formatter.go

+ 2
- 1
text_formatter.go Wyświetl plik

@@ -10,6 +10,7 @@ import (
10 10
 	"strings"
11 11
 	"sync"
12 12
 	"time"
13
+	"unicode/utf8"
13 14
 )
14 15
 
15 16
 const (
@@ -95,7 +96,7 @@ func (f *TextFormatter) init(entry *Entry) {
95 96
 	}
96 97
 	// Get the max length of the level text
97 98
 	for _, level := range AllLevels {
98
-		levelTextLength := len(level.String())
99
+		levelTextLength := utf8.RuneCount([]byte(level.String()))
99 100
 		if levelTextLength > f.levelTextMaxLength {
100 101
 			f.levelTextMaxLength = levelTextLength
101 102
 		}

Ładowanie…
Anuluj
Zapisz