| 102 | } |
| 103 | |
| 104 | func (f *TextFormatter) init(entry *Entry) { |
| 105 | if entry.Logger != nil { |
| 106 | f.isTerminal = checkIfTerminal(entry.Logger.Out) |
| 107 | } |
| 108 | // Get the max length of the level text |
| 109 | for _, level := range AllLevels { |
| 110 | levelTextLength := utf8.RuneCount([]byte(level.String())) |
| 111 | if levelTextLength > f.levelTextMaxLength { |
| 112 | f.levelTextMaxLength = levelTextLength |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | func (f *TextFormatter) isColored() bool { |
| 118 | isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows")) |