Merge remote-tracking branch 'origin/tuoyun' into tuoyun

pull/218/head
Gordon 3 years ago
commit 0a58e7433e

@ -1 +1 @@
Subproject commit 884d0d0b2712f269db3f7f7fc7309759854dcb03 Subproject commit 7b66c0ab78be494ce2cfe23de37543dd11c2d354

@ -10,6 +10,7 @@ import (
"Open_IM/internal/api/office" "Open_IM/internal/api/office"
apiThird "Open_IM/internal/api/third" apiThird "Open_IM/internal/api/third"
"Open_IM/internal/api/user" "Open_IM/internal/api/user"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"flag" "flag"
@ -125,7 +126,7 @@ func main() {
officeGroup.POST("/get_send_tag_log", office.GetTagSendLogs) officeGroup.POST("/get_send_tag_log", office.GetTagSendLogs)
} }
apiThird.MinioInit() apiThird.MinioInit()
log.NewPrivateLog("api") log.NewPrivateLog(constant.LogFileName)
ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port") ginPort := flag.Int("port", 10000, "get ginServerPort from cmd,default 10000 as port")
flag.Parse() flag.Parse()
r.Run(":" + strconv.Itoa(*ginPort)) r.Run(":" + strconv.Itoa(*ginPort))

@ -2,6 +2,7 @@ package main
import ( import (
"Open_IM/internal/demo/register" "Open_IM/internal/demo/register"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"flag" "flag"
@ -23,7 +24,7 @@ func main() {
authRouterGroup.POST("/login", register.Login) authRouterGroup.POST("/login", register.Login)
authRouterGroup.POST("/reset_password", register.ResetPassword) authRouterGroup.POST("/reset_password", register.ResetPassword)
} }
log.NewPrivateLog("demo") log.NewPrivateLog(constant.LogFileName)
ginPort := flag.Int("port", 42233, "get ginServerPort from cmd,default 42233 as port") ginPort := flag.Int("port", 42233, "get ginServerPort from cmd,default 42233 as port")
flag.Parse() flag.Parse()
r.Run(":" + strconv.Itoa(*ginPort)) r.Run(":" + strconv.Itoa(*ginPort))

@ -1,6 +1,7 @@
package main package main
import ( import (
"Open_IM/pkg/common/constant"
commonDB "Open_IM/pkg/common/db" commonDB "Open_IM/pkg/common/db"
"Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
@ -8,7 +9,7 @@ import (
) )
func main() { func main() {
log.NewPrivateLog("timer") log.NewPrivateLog(constant.LogFileName)
//for { //for {
// fmt.Println("start delete mongodb expired record") // fmt.Println("start delete mongodb expired record")
// timeUnixBegin := time.Now().Unix() // timeUnixBegin := time.Now().Unix()

@ -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)

@ -2,6 +2,7 @@ package logic
import ( import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/kafka" "Open_IM/pkg/common/kafka"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
) )
@ -13,7 +14,7 @@ var (
) )
func Init() { func Init() {
log.NewPrivateLog(config.Config.ModuleName.MsgTransferName) log.NewPrivateLog(constant.LogFileName)
persistentCH.Init() persistentCH.Init()
historyCH.Init() historyCH.Init()
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ms2pschat.Addr, config.Config.Kafka.Ms2pschat.Topic) producer = kafka.NewKafkaProducer(config.Config.Kafka.Ms2pschat.Addr, config.Config.Kafka.Ms2pschat.Topic)

@ -24,7 +24,7 @@ var (
) )
func Init(rpcPort int) { func Init(rpcPort int) {
log.NewPrivateLog(config.Config.ModuleName.PushName) log.NewPrivateLog(constant.LogFileName)
rpcServer.Init(rpcPort) rpcServer.Init(rpcPort)
pushCh.Init() pushCh.Init()
pushTerminal = []int32{constant.IOSPlatformID, constant.AndroidPlatformID} pushTerminal = []int32{constant.IOSPlatformID, constant.AndroidPlatformID}

@ -24,7 +24,7 @@ type adminCMSServer struct {
} }
func NewAdminCMSServer(port int) *adminCMSServer { func NewAdminCMSServer(port int) *adminCMSServer {
log.NewPrivateLog("AdminCMS") log.NewPrivateLog(constant.LogFileName)
return &adminCMSServer{ return &adminCMSServer{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImAdminCMSName, rpcRegisterName: config.Config.RpcRegisterName.OpenImAdminCMSName,

@ -63,7 +63,7 @@ type rpcAuth struct {
} }
func NewRpcAuthServer(port int) *rpcAuth { func NewRpcAuthServer(port int) *rpcAuth {
log.NewPrivateLog("auth") log.NewPrivateLog(constant.LogFileName)
return &rpcAuth{ return &rpcAuth{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImAuthName, rpcRegisterName: config.Config.RpcRegisterName.OpenImAuthName,

@ -29,7 +29,7 @@ type friendServer struct {
} }
func NewFriendServer(port int) *friendServer { func NewFriendServer(port int) *friendServer {
log.NewPrivateLog("friend") log.NewPrivateLog(constant.LogFileName)
return &friendServer{ return &friendServer{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName, rpcRegisterName: config.Config.RpcRegisterName.OpenImFriendName,

@ -31,7 +31,7 @@ type groupServer struct {
} }
func NewGroupServer(port int) *groupServer { func NewGroupServer(port int) *groupServer {
log.NewPrivateLog("group") log.NewPrivateLog(constant.LogFileName)
return &groupServer{ return &groupServer{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName, rpcRegisterName: config.Config.RpcRegisterName.OpenImGroupName,

@ -31,7 +31,7 @@ type messageCMSServer struct {
} }
func NewMessageCMSServer(port int) *messageCMSServer { func NewMessageCMSServer(port int) *messageCMSServer {
log.NewPrivateLog("MessageCMS") log.NewPrivateLog(constant.LogFileName)
return &messageCMSServer{ return &messageCMSServer{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImMessageCMSName, rpcRegisterName: config.Config.RpcRegisterName.OpenImMessageCMSName,

@ -2,6 +2,7 @@ package msg
import ( import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/kafka" "Open_IM/pkg/common/kafka"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
@ -22,7 +23,7 @@ type rpcChat struct {
} }
func NewRpcChatServer(port int) *rpcChat { func NewRpcChatServer(port int) *rpcChat {
log.NewPrivateLog("msg") log.NewPrivateLog(constant.LogFileName)
rc := rpcChat{ rc := rpcChat{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfflineMessageName, rpcRegisterName: config.Config.RpcRegisterName.OpenImOfflineMessageName,

@ -26,7 +26,7 @@ type officeServer struct {
} }
func NewOfficeServer(port int) *officeServer { func NewOfficeServer(port int) *officeServer {
log.NewPrivateLog("office") log.NewPrivateLog(constant.LogFileName)
return &officeServer{ return &officeServer{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImOfficeName, rpcRegisterName: config.Config.RpcRegisterName.OpenImOfficeName,

@ -19,10 +19,10 @@ import (
//open_im_sdk "Open_IM/pkg/proto/sdk_ws" //open_im_sdk "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
//"context" //"context"
errors "Open_IM/pkg/common/http"
"net" "net"
"strconv" "strconv"
"strings" "strings"
errors "Open_IM/pkg/common/http"
"google.golang.org/grpc" "google.golang.org/grpc"
) )
@ -35,7 +35,7 @@ type statisticsServer struct {
} }
func NewStatisticsServer(port int) *statisticsServer { func NewStatisticsServer(port int) *statisticsServer {
log.NewPrivateLog("Statistics") log.NewPrivateLog(constant.LogFileName)
return &statisticsServer{ return &statisticsServer{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImStatisticsName, rpcRegisterName: config.Config.RpcRegisterName.OpenImStatisticsName,

@ -32,7 +32,7 @@ type userServer struct {
} }
func NewUserServer(port int) *userServer { func NewUserServer(port int) *userServer {
log.NewPrivateLog("user") log.NewPrivateLog(constant.LogFileName)
return &userServer{ return &userServer{
rpcPort: port, rpcPort: port,
rpcRegisterName: config.Config.RpcRegisterName.OpenImUserName, rpcRegisterName: config.Config.RpcRegisterName.OpenImUserName,

@ -230,3 +230,5 @@ func GroupIsBanPrivateChat(status int32) bool {
} }
const BigVersion = "v3" const BigVersion = "v3"
const LogFileName = "OpenIM.log"

@ -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

@ -63,10 +63,10 @@ func loggerInit(moduleName string) *Logger {
} }
func NewLfsHook(rotationTime time.Duration, maxRemainNum uint, moduleName string) logrus.Hook { func NewLfsHook(rotationTime time.Duration, maxRemainNum uint, moduleName string) logrus.Hook {
lfsHook := lfshook.NewHook(lfshook.WriterMap{ lfsHook := lfshook.NewHook(lfshook.WriterMap{
logrus.DebugLevel: initRotateLogs(rotationTime, maxRemainNum, "debug", moduleName), logrus.DebugLevel: initRotateLogs(rotationTime, maxRemainNum, "all", moduleName),
logrus.InfoLevel: initRotateLogs(rotationTime, maxRemainNum, "info", moduleName), logrus.InfoLevel: initRotateLogs(rotationTime, maxRemainNum, "all", moduleName),
logrus.WarnLevel: initRotateLogs(rotationTime, maxRemainNum, "warn", moduleName), logrus.WarnLevel: initRotateLogs(rotationTime, maxRemainNum, "all", moduleName),
logrus.ErrorLevel: initRotateLogs(rotationTime, maxRemainNum, "error", moduleName), logrus.ErrorLevel: initRotateLogs(rotationTime, maxRemainNum, "all", moduleName),
}, &nested.Formatter{ }, &nested.Formatter{
TimestampFormat: "2006-01-02 15:04:05.000", TimestampFormat: "2006-01-02 15:04:05.000",
HideKeys: false, HideKeys: false,

Loading…
Cancel
Save