//Format formats a logrus.Entry into a byte array to view
Format formats a logrus.Entry into a byte array to view
// Format formats a logrus . Entry into a byte array to view
func (f *CustomFormatter) Format(entry *logrus.Entry) ([]byte, error) {
	b := &bytes.Buffer{}
	if !f.DisableTimestamp {
		b.WriteString(entry.Time.Format(time.RFC3339))
		b.WriteByte(' ')
	}
	if !f.DisableSeverity {
		b.WriteString("- ")
		colorFunc := levelToColor[entry.Level]
		b.WriteString(colorFunc(entry.Level.String()))
		b.WriteByte(' ')
	}
	for _, v := range entry.Data {
		b.WriteByte('[')
		f.appendValue(b, v)
		b.WriteByte(']')
		b.WriteByte(' ')
	}
	if len(entry.Message) > 0 {
		b.WriteString(entry.Message)
	}
	b.WriteByte('\n')
	return b.Bytes(), nil
}
func ( f * CustomFormatter ) Format ( entry * logrus . Entry ) ( [ ] byte , error ) { b := & bytes . Buffer { } if ! f . DisableTimestamp { b . WriteString ( entry . Time . Format ( time . RFC3339 ) ) b . WriteByte ( ' ' ) } if ! f . DisableSeverity { b . WriteString ( " " ) colorFunc := levelToColor [ entry . Level ] b . WriteString ( colorFunc ( entry . Level . String ( ) ) ) b . WriteByte ( ' ' ) } for _ , v := range entry . Data { b . WriteByte ( '[' ) f . appendValue ( b , v ) b . WriteByte ( ']' ) b . WriteByte ( ' ' ) } if len ( entry . Message ) > 0 { b . WriteString ( entry . Message ) } b . WriteByte ( '\n' ) return b . Bytes ( ) , nil }
Format formats a logrus.Entry into a byte array to view
Format formats a logrus . Entry into a byte array to view