MCPcopy
hub / github.com/sirupsen/logrus / init

Method init

text_formatter.go:104–115  ·  text_formatter.go::TextFormatter.init
(entry *Entry)

Source from the content-addressed store, hash-verified

102}
103
104func (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
117func (f *TextFormatter) isColored() bool {
118 isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows"))

Callers 2

FormatMethod · 0.95
TestPadLevelTextFunction · 0.95

Calls 2

checkIfTerminalFunction · 0.70
StringMethod · 0.45

Tested by 1

TestPadLevelTextFunction · 0.76