mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 03:26:57 +08:00
fix cron
This commit is contained in:
parent
5feffcef42
commit
c7a8536278
@ -5,9 +5,7 @@ import (
|
||||
"OpenIM/pkg/common/cmd"
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/log"
|
||||
log2 "OpenIM/pkg/common/logger"
|
||||
"OpenIM/pkg/common/mw"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/OpenIMSDK/openKeeper"
|
||||
"os"
|
||||
@ -42,7 +40,7 @@ func run(port int) error {
|
||||
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(port)
|
||||
}
|
||||
fmt.Println("start api server, address: ", address, ", OpenIM version: ", config.Version)
|
||||
log2.Info(context.Background(), "start server success", "address", address, "version", config.Version)
|
||||
//log2.Info(context.Background(), "start server success", "address", address, "version", config.Version)
|
||||
log.Info("s", "start server")
|
||||
err = router.Run(address)
|
||||
if err != nil {
|
||||
|
@ -82,7 +82,7 @@ func loggerInit(moduleName string) *LogrusLogger {
|
||||
HideKeys: false,
|
||||
FieldsOrder: []string{"PID", "FilePath", "OperationID"},
|
||||
})
|
||||
|
||||
logger.SetFormatter(&logrus.JSONFormatter{})
|
||||
//File name and line number display hook
|
||||
logger.AddHook(newFileHook())
|
||||
|
||||
@ -158,47 +158,6 @@ func Warning(token, OperationID, format string, args ...interface{}) {
|
||||
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
func InfoByArgs(format string, args ...interface{}) {
|
||||
logger.WithFields(logrus.Fields{}).Infof(format, args)
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
func ErrorByArgs(format string, args ...interface{}) {
|
||||
logger.WithFields(logrus.Fields{}).Errorf(format, args...)
|
||||
}
|
||||
|
||||
//Print log information in k, v format,
|
||||
//kv is best to appear in pairs. tipInfo is the log prompt information for printing,
|
||||
//and kv is the key and value for printing.
|
||||
//Deprecated
|
||||
func InfoByKv(tipInfo, OperationID string, args ...interface{}) {
|
||||
fields := make(logrus.Fields)
|
||||
argsHandle(OperationID, fields, args)
|
||||
logger.WithFields(fields).Info(tipInfo)
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
func ErrorByKv(tipInfo, OperationID string, args ...interface{}) {
|
||||
fields := make(logrus.Fields)
|
||||
argsHandle(OperationID, fields, args)
|
||||
logger.WithFields(fields).Error(tipInfo)
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
func DebugByKv(tipInfo, OperationID string, args ...interface{}) {
|
||||
fields := make(logrus.Fields)
|
||||
argsHandle(OperationID, fields, args)
|
||||
logger.WithFields(fields).Debug(tipInfo)
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
func WarnByKv(tipInfo, OperationID string, args ...interface{}) {
|
||||
fields := make(logrus.Fields)
|
||||
argsHandle(OperationID, fields, args)
|
||||
logger.WithFields(fields).Warn(tipInfo)
|
||||
}
|
||||
|
||||
//internal method
|
||||
func argsHandle(OperationID string, fields logrus.Fields, args []interface{}) {
|
||||
for i := 0; i < len(args); i += 2 {
|
||||
@ -240,7 +199,6 @@ func ShowLog(ctx context.Context) {
|
||||
t := ctx.Value(tracelog.TraceLogKey).(*tracelog.FuncInfos)
|
||||
OperationID := tracelog.GetOperationID(ctx)
|
||||
for _, v := range *t.Funcs {
|
||||
|
||||
if v.Err != nil {
|
||||
ctxLogger.WithFields(logrus.Fields{
|
||||
"OperationID": OperationID,
|
||||
|
@ -40,7 +40,6 @@ func rpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.Unary
|
||||
opUserID = opts[0]
|
||||
}
|
||||
ctx = tracelog.SetFuncInfos(ctx, funcName, operationID)
|
||||
defer log.ShowLog(ctx)
|
||||
tracelog.SetCtxInfo(ctx, funcName, err, "opUserID", opUserID, "rpcReq", rpcString(req))
|
||||
resp, err = handler(ctx, req)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user