From 3bcc33f269c1c134437e26046e24e29c07f806e8 Mon Sep 17 00:00:00 2001 From: luhaoling <2198702716@qq.com> Date: Fri, 2 Feb 2024 15:13:52 +0800 Subject: [PATCH] fix the log output format --- tools/component/component.go | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/tools/component/component.go b/tools/component/component.go index ae8eb96ef..7a406a408 100644 --- a/tools/component/component.go +++ b/tools/component/component.go @@ -22,7 +22,6 @@ import ( "github.com/openimsdk/open-im-server/v3/pkg/common/db/unrelation" "github.com/openimsdk/open-im-server/v3/pkg/common/discoveryregister/zookeeper" "github.com/openimsdk/open-im-server/v3/pkg/common/kafka" - "log" "os" "strings" "time" @@ -38,7 +37,6 @@ const ( // defaultCfgPath is the default path of the configuration file. defaultCfgPath = "../../../../../config/config.yaml" maxRetry = 300 - colorRed = 31 ) var ( @@ -90,7 +88,7 @@ func main() { for _, check := range checks { err = check.function() if err != nil { - ErrorPrint(fmt.Sprintf("Starting %s failed:%v.", check.name, err)) + component.ErrorPrint(fmt.Sprintf("Starting %s failed:%v.", check.name, err)) allSuccess = false } else { component.SuccessPrint(fmt.Sprintf("%s connected successfully", check.name)) @@ -246,12 +244,3 @@ func getEnv(key, fallback string) string { } return fallback } - -func ErrorPrint(s string) { - colorPrint(colorRed, "%v", s) -} - -func colorPrint(colorCode int, format string, a ...interface{}) { - log.Printf("\x1b[%dm%s\x1b[0m\n", colorCode, fmt.Sprintf(format, a...)) -} -