MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin-Playground / Format

Method Format

abineundo/console_windows.go:115–131  ·  view source on GitHub ↗

Format implements logrus.Formatter

(entry *logrus.Entry)

Source from the content-addressed store, hash-verified

113
114// Format implements logrus.Formatter
115func (f logFormat) Format(entry *logrus.Entry) ([]byte, error) {
116 buf := new(bytes.Buffer)
117
118 buf.WriteByte('[')
119 if f.hasColor {
120 buf.WriteString(getLogLevelColorCode(entry.Level))
121 }
122 buf.WriteString(strings.ToUpper(entry.Level.String()))
123 if f.hasColor {
124 buf.WriteString(colorReset)
125 }
126 buf.WriteString("] ")
127 buf.WriteString(entry.Message)
128 buf.WriteString(" \n")
129
130 return buf.Bytes(), nil
131}
132
133// getLogLevelColorCode 获取日志等级对应色彩code
134func getLogLevelColorCode(level logrus.Level) string {

Callers 5

parseTimeFunction · 0.80
initFunction · 0.80
initFunction · 0.80
initFunction · 0.80

Calls 1

getLogLevelColorCodeFunction · 0.85

Tested by

no test coverage detected