Merge log files

This commit is contained in:
wenxu12345 2022-03-31 11:28:51 +08:00
parent ecd2f0e2bf
commit 9fbfbfb23b
2 changed files with 5 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package gate
import ( import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/statistics" "Open_IM/pkg/statistics"
"fmt" "fmt"
@ -20,7 +21,7 @@ var (
func Init(rpcPort, wsPort int) { func Init(rpcPort, wsPort int) {
//log initialization //log initialization
log.NewPrivateLog(config.Config.ModuleName.LongConnSvrName) log.NewPrivateLog(constant.LogFileName)
rwLock = new(sync.RWMutex) rwLock = new(sync.RWMutex)
validate = validator.New() validate = validator.New()
statistics.NewStatistics(&sendMsgCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway sendMsgCount", sendMsgCount), 300) statistics.NewStatistics(&sendMsgCount, config.Config.ModuleName.LongConnSvrName, fmt.Sprintf("%d second recv to msg_gateway sendMsgCount", sendMsgCount), 300)

View File

@ -2,6 +2,7 @@ package db
import ( import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"fmt" "fmt"
@ -33,6 +34,7 @@ func key(dbAddress, dbName string) string {
} }
func init() { func init() {
log.NewPrivateLog(constant.LogFileName)
//var mgoSession *mgo.Session //var mgoSession *mgo.Session
var mongoClient *mongo.Client var mongoClient *mongo.Client
var err1 error var err1 error
@ -51,7 +53,7 @@ func init() {
} }
mongoClient, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri)) mongoClient, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))
if err != nil{ if err != nil {
log.NewError(" mongo.Connect failed, try ", utils.GetSelfFuncName(), err.Error(), uri) log.NewError(" mongo.Connect failed, try ", utils.GetSelfFuncName(), err.Error(), uri)
time.Sleep(time.Duration(30) * time.Second) time.Sleep(time.Duration(30) * time.Second)
mongoClient, err1 = mongo.Connect(context.TODO(), options.Client().ApplyURI(uri)) mongoClient, err1 = mongo.Connect(context.TODO(), options.Client().ApplyURI(uri))