From 7de5ec84db34d046e08987cafa559b67de18cbe1 Mon Sep 17 00:00:00 2001 From: karldoenitz Date: Sun, 22 Dec 2024 22:09:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=88=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E5=BF=97=E4=B8=8D=E5=B8=A6=E6=9C=89=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logger/log.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/logger/log.go b/logger/log.go index b44f6fc..ffebb2c 100644 --- a/logger/log.go +++ b/logger/log.go @@ -125,7 +125,7 @@ func initLogger() { Warning.Level = WarningLevel // 将错误日志写入log文件 Error = &TiLog{} - Error.Logger = log.New(io.MultiWriter(file, os.Stderr), "\x1b[41m ERROR \x1b[0m ", log.Ldate|log.Ltime) + Error.Logger = log.New(file, " ERROR ", log.Ldate|log.Ltime) Error.Level = ErrorLevel } @@ -201,7 +201,7 @@ func InitTrace(level string) { break default: logFile := logFileMapping[level] - Trace.Logger = log.New(io.MultiWriter(logFile, os.Stderr), "\x1b[42m TRACE \x1b[0m ", log.Ldate|log.Ltime) + Trace.Logger = log.New(logFile, " TRACE ", log.Ldate|log.Ltime) } } @@ -217,7 +217,7 @@ func InitInfo(level string) { break default: logFile := logFileMapping[level] - Info.Logger = log.New(io.MultiWriter(logFile, os.Stderr), "\x1b[44m INFO \x1b[0m ", log.Ldate|log.Ltime) + Info.Logger = log.New(logFile, " INFO ", log.Ldate|log.Ltime) break } } @@ -234,7 +234,7 @@ func InitWarning(level string) { break default: logFile := logFileMapping[level] - Warning.Logger = log.New(io.MultiWriter(logFile, os.Stderr), "\x1b[43m WARNING \x1b[0m ", log.Ldate|log.Ltime) + Warning.Logger = log.New(logFile, " WARNING ", log.Ldate|log.Ltime) break } } @@ -251,7 +251,7 @@ func InitError(level string) { break default: logFile := logFileMapping[level] - Error.Logger = log.New(io.MultiWriter(logFile, os.Stderr), " ERROR: ", log.Ldate|log.Ltime) + Error.Logger = log.New(logFile, " ERROR: ", log.Ldate|log.Ltime) break } }