mirror of https://github.com/sirupsen/logrus.git
len => RuneCount
note: this is not currently easily testable without a larger diff that refactors the levels
This commit is contained in:
parent
dcce32597d
commit
af6ed964ef
|
@ -10,6 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
"unicode/utf8"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -95,7 +96,7 @@ func (f *TextFormatter) init(entry *Entry) {
|
||||||
}
|
}
|
||||||
// Get the max length of the level text
|
// Get the max length of the level text
|
||||||
for _, level := range AllLevels {
|
for _, level := range AllLevels {
|
||||||
levelTextLength := len(level.String())
|
levelTextLength := utf8.RuneCount([]byte(level.String()))
|
||||||
if levelTextLength > f.levelTextMaxLength {
|
if levelTextLength > f.levelTextMaxLength {
|
||||||
f.levelTextMaxLength = levelTextLength
|
f.levelTextMaxLength = levelTextLength
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue