优化color

This commit is contained in:
源文雨 2023-02-28 12:15:54 +08:00
parent 0944fc7854
commit 2704d3e7d4

View File

@ -30,16 +30,14 @@ type LogFormat struct{}
func (f LogFormat) Format(entry *logrus.Entry) ([]byte, error) {
buf := new(bytes.Buffer)
buf.WriteString(getLogLevelColorCode(entry.Level))
buf.WriteByte('[')
buf.WriteString(getLogLevelColorCode(entry.Level))
buf.WriteString(strings.ToUpper(entry.Level.String()))
buf.WriteString(colorReset)
buf.WriteString("] ")
buf.WriteString(entry.Message)
buf.WriteString(" \n")
buf.WriteString(colorReset)
return buf.Bytes(), nil
}