mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 02:58:26 +08:00
log
This commit is contained in:
parent
e9ad462f9e
commit
60f0c80c36
@ -48,7 +48,7 @@ func main() {
|
|||||||
// gin.SetMode(gin.DebugMode)
|
// gin.SetMode(gin.DebugMode)
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
r.Use(utils.CorsHandler())
|
r.Use(utils.CorsHandler())
|
||||||
log.Info("load config: ", config.Config)
|
fmt.Println("load config: ", config.Config)
|
||||||
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||||
if config.Config.Prometheus.Enable {
|
if config.Config.Prometheus.Enable {
|
||||||
r.GET("/metrics", promePkg.PrometheusHandler())
|
r.GET("/metrics", promePkg.PrometheusHandler())
|
||||||
@ -226,10 +226,10 @@ func main() {
|
|||||||
if config.Config.Api.ListenIP != "" {
|
if config.Config.Api.ListenIP != "" {
|
||||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
||||||
}
|
}
|
||||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
|
fmt.Println("start api server, address: \n", address)
|
||||||
fmt.Println("start api server, address: ", address)
|
|
||||||
err := r.Run(address)
|
err := r.Run(address)
|
||||||
if err != nil {
|
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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -545,7 +544,6 @@ type PDefaultTips struct {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cfgName := os.Getenv("CONFIG_NAME")
|
cfgName := os.Getenv("CONFIG_NAME")
|
||||||
fmt.Println("GET IM DEFAULT CONFIG PATH :", Root, "ENV PATH:", cfgName)
|
|
||||||
if len(cfgName) != 0 {
|
if len(cfgName) != 0 {
|
||||||
bytes, err := ioutil.ReadFile(filepath.Join(cfgName, "config", "config.yaml"))
|
bytes, err := ioutil.ReadFile(filepath.Join(cfgName, "config", "config.yaml"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -77,7 +77,7 @@ func init() {
|
|||||||
panic(err1.Error())
|
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
|
// mongodb create index
|
||||||
if err := createMongoIndex(mongoClient, cSendLog, false, "send_id", "-send_time"); err != nil {
|
if err := createMongoIndex(mongoClient, cSendLog, false, "send_id", "-send_time"); err != nil {
|
||||||
fmt.Println("send_id", "-send_time", "index create failed", err.Error())
|
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 {
|
if err := createMongoIndex(mongoClient, cTag, true, "tag_id"); err != nil {
|
||||||
fmt.Println("tag_id", "index create failed", err.Error())
|
fmt.Println("tag_id", "index create failed", err.Error())
|
||||||
}
|
}
|
||||||
fmt.Println("create index success")
|
fmt.Println("createMongoIndex success")
|
||||||
DB.mongoClient = mongoClient
|
DB.mongoClient = mongoClient
|
||||||
|
|
||||||
// redis pool init
|
// redis pool init
|
||||||
|
@ -12,11 +12,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
//init managers
|
|
||||||
for k, v := range config.Config.Manager.AppManagerUid {
|
for k, v := range config.Config.Manager.AppManagerUid {
|
||||||
user, err := GetUserByUserID(v)
|
_, err := GetUserByUserID(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("GetUserByUserID failed ", err.Error(), v, user)
|
|
||||||
} else {
|
} else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -30,9 +28,10 @@ func init() {
|
|||||||
appMgr.AppMangerLevel = constant.AppAdmin
|
appMgr.AppMangerLevel = constant.AppAdmin
|
||||||
err = UserRegister(appMgr)
|
err = UserRegister(appMgr)
|
||||||
if err != nil {
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user