From 050a8e4575950281f5ca4ca6699eea6841de0309 Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Thu, 5 Dec 2024 14:45:14 +0800 Subject: [PATCH] improve Signed-off-by: Lixia (Sylvia) Lei --- internal/trace/text_formatter.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/trace/text_formatter.go b/internal/trace/text_formatter.go index 9f4bfdea0..bb6e2de46 100644 --- a/internal/trace/text_formatter.go +++ b/internal/trace/text_formatter.go @@ -36,12 +36,12 @@ func (f *TextFormatter) Format(entry *logrus.Entry) ([]byte, error) { timestamp := entry.Time.Format(time.RFC3339Nano) levelText := strings.ToUpper(entry.Level.String()) - buf.WriteString(fmt.Sprintf("[%s][%s]: %s\n", timestamp, levelText, entry.Message)) + fmt.Fprintf(&buf, "[%s][%s]: %s\n", timestamp, levelText, entry.Message) // printing data fields if len(entry.Data) != 0 { buf.WriteString("[Data]:\n") for k, v := range entry.Data { - buf.WriteString(fmt.Sprintf(" %s=%v\n", k, v)) + fmt.Fprintf(&buf, " %s=%v\n", k, v) } }