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

Method Format

console/console_windows.go:105–121  ·  view source on GitHub ↗

Format implements logrus.Formatter

(entry *logrus.Entry)

Source from the content-addressed store, hash-verified

103
104// Format implements logrus.Formatter
105func (f logFormat) Format(entry *logrus.Entry) ([]byte, error) {
106 buf := new(bytes.Buffer)
107
108 buf.WriteByte('[')
109 if f.hasColor {
110 buf.WriteString(getLogLevelColorCode(entry.Level))
111 }
112 buf.WriteString(strings.ToUpper(entry.Level.String()))
113 if f.hasColor {
114 buf.WriteString(colorReset)
115 }
116 buf.WriteString("] ")
117 buf.WriteString(entry.Message)
118 buf.WriteString(" \n")
119
120 return buf.Bytes(), nil
121}
122
123// getLogLevelColorCode 获取日志等级对应色彩code
124func getLogLevelColorCode(level logrus.Level) string {

Callers 6

registerMethod · 0.80
customtextFunction · 0.80
initFunction · 0.80
botruntimeFunction · 0.80
botstatusFunction · 0.80
mainFunction · 0.80

Calls 2

getLogLevelColorCodeFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected