From 60f0c80c36267395942e5428356dad0aa23cdcb3 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Wed, 14 Sep 2022 12:31:24 +0800 Subject: [PATCH] log --- cmd/open_im_api/main.go | 8 ++++---- pkg/common/config/config.go | 2 -- pkg/common/db/model.go | 4 ++-- pkg/common/db/mysql_model/im_mysql_model/user_model.go | 9 ++++----- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/cmd/open_im_api/main.go b/cmd/open_im_api/main.go index a7f4e9573..0c839fc56 100644 --- a/cmd/open_im_api/main.go +++ b/cmd/open_im_api/main.go @@ -48,7 +48,7 @@ func main() { // gin.SetMode(gin.DebugMode) r := gin.Default() r.Use(utils.CorsHandler()) - log.Info("load config: ", config.Config) + fmt.Println("load config: ", config.Config) r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) if config.Config.Prometheus.Enable { r.GET("/metrics", promePkg.PrometheusHandler()) @@ -226,10 +226,10 @@ func main() { if config.Config.Api.ListenIP != "" { address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort) } - address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort) - fmt.Println("start api server, address: ", address) + fmt.Println("start api server, address: \n", address) err := r.Run(address) if err != nil { - log.Error("", "api run failed ", *ginPort, err.Error()) + log.Error("", "api run failed ", address, err.Error()) + panic("api start failed " + err.Error()) } } diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index b2222d6c2..730d7c0f5 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -1,7 +1,6 @@ package config import ( - "fmt" "io/ioutil" "os" "path/filepath" @@ -545,7 +544,6 @@ type PDefaultTips struct { func init() { cfgName := os.Getenv("CONFIG_NAME") - fmt.Println("GET IM DEFAULT CONFIG PATH :", Root, "ENV PATH:", cfgName) if len(cfgName) != 0 { bytes, err := ioutil.ReadFile(filepath.Join(cfgName, "config", "config.yaml")) if err != nil { diff --git a/pkg/common/db/model.go b/pkg/common/db/model.go index 0fd699018..7fe53b77a 100644 --- a/pkg/common/db/model.go +++ b/pkg/common/db/model.go @@ -77,7 +77,7 @@ func init() { panic(err1.Error()) } } - fmt.Println("0", utils.GetSelfFuncName(), "mongo driver client init success: ", uri) + fmt.Println("mongo driver client init success: ", uri) // mongodb create index if err := createMongoIndex(mongoClient, cSendLog, false, "send_id", "-send_time"); err != nil { fmt.Println("send_id", "-send_time", "index create failed", err.Error()) @@ -100,7 +100,7 @@ func init() { if err := createMongoIndex(mongoClient, cTag, true, "tag_id"); err != nil { fmt.Println("tag_id", "index create failed", err.Error()) } - fmt.Println("create index success") + fmt.Println("createMongoIndex success") DB.mongoClient = mongoClient // redis pool init diff --git a/pkg/common/db/mysql_model/im_mysql_model/user_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_model.go index 7eb6fcbfe..5e280418c 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/user_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_model.go @@ -12,11 +12,9 @@ import ( ) func init() { - //init managers for k, v := range config.Config.Manager.AppManagerUid { - user, err := GetUserByUserID(v) + _, err := GetUserByUserID(v) if err != nil { - fmt.Println("GetUserByUserID failed ", err.Error(), v, user) } else { continue } @@ -30,9 +28,10 @@ func init() { appMgr.AppMangerLevel = constant.AppAdmin err = UserRegister(appMgr) if err != nil { - fmt.Println("AppManager insert error", err.Error(), appMgr, "time: ", appMgr.Birth.Unix()) + fmt.Println("AppManager insert error ", err.Error(), appMgr) + } else { + fmt.Println("AppManager insert ", appMgr) } - } }