From d50d4e7f1b7e3f7e76cb835a52d1174602b75c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=B9=BF?= Date: Mon, 23 Jan 2023 12:08:55 +0800 Subject: [PATCH] fix format --- console.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/console.go b/console.go index 2ca83a4..fcea5e2 100644 --- a/console.go +++ b/console.go @@ -1,6 +1,9 @@ package gologger -import "fmt" +import ( + "fmt" + "strings" +) const ( ErrorTemplate = "\033[1;31;40m%s\033[0m\n" @@ -19,8 +22,12 @@ func (c *ConsoleAppender) GetName() string { func (c *ConsoleAppender) Append(logEvent LogEvent) { data := []interface{}{ logEvent.Ts.Format("2006-01-02 15:04:05"), + " ", } - data = append(data, logEvent.Data...) + dmsg := fmt.Sprint(logEvent.Data) + dmsg = strings.TrimLeft(dmsg, "[") + dmsg = strings.TrimRight(dmsg, "]") + data = append(data, dmsg) logMsg := fmt.Sprint(data...) switch logEvent.Level { case Error: