Skip to content

Commit

Permalink
update log (openimsdk#451)
Browse files Browse the repository at this point in the history
* add pin friend

* Delete open-im-sdk-core.2023-11-28

* update time for usercommand

* update name JSON to friendIDsAndIsPinned

* Update go.mod

* remove bug

* fix pin friend js

* change pin friend name and fix bugs

* change pin friend name and fix bugs

* change pin friend name and fix bugs

* fix bugs

* add updateUserInfoEx

* deprecated updateUserInfo

* add ex for friend

* update ex

* update ex

* fix test

* fix go mod

* fix go mod

* fix go mod

* search conversation, fix some name bugs

* add search conversation js

* update data transfer bug

* update data transfer bug

* update data transfer bug

* update data transfer bug

* update go.mod

* update notification

* update notification

* update notification

* update notification

* update notification

* update log

* update log
  • Loading branch information
AndrewZuo01 committed Dec 28, 2023
1 parent 6b21a26 commit 1508957
Show file tree
Hide file tree
Showing 17 changed files with 359 additions and 559 deletions.
12 changes: 8 additions & 4 deletions cmd/gordon_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
package main

import (
"context"
"encoding/json"
"github.com/openimsdk/openim-sdk-core/v3/pkg/log"
"errors"
"github.com/OpenIMSDK/tools/log"
"github.com/openimsdk/openim-sdk-core/v3/pkg/network"
"github.com/openimsdk/openim-sdk-core/v3/pkg/server_api_params"
"github.com/openimsdk/openim-sdk-core/v3/pkg/utils"
Expand All @@ -40,6 +42,7 @@ var (
//SECRET = "4zbF9Y6Fs1QJ0hsmpC3B676txZcCnjcZ"
SENDINTERVAL = 20
)
var ctx context.Context

const PlatformID = 3

Expand All @@ -62,16 +65,17 @@ func ggetToken(uid string) string {
req.OperationID = utils.OperationIDGenerator()
r, err := network.Post2Api(url, req, "a")
if err != nil {
log.Error(req.OperationID, "Post2Api failed ", err.Error(), url, req)
log.ZError(ctx, "Post2Api failed ", errors.New("Post2Api failed "), "operationID", req.OperationID, "url", url, "req", req)
return ""
}
var stcResp ResToken
err = json.Unmarshal(r, &stcResp)
if stcResp.ErrCode != 0 {
log.Error(req.OperationID, "ErrCode failed ", stcResp.ErrCode, stcResp.ErrMsg, url, req)
log.ZError(ctx, "ErrCode failed ", errors.New("ErrCode failed "), "operationID", req.OperationID,
"errorCode", stcResp.ErrCode, "errMsg", stcResp.ErrMsg, "url", url, "req", req)
return ""
}
log.Info(req.OperationID, "get token: ", stcResp.Data.Token)
log.ZInfo(ctx, "get token: ", "operationID", req.OperationID, "token", stcResp.Data.Token)
return stcResp.Data.Token
}

Expand Down
7 changes: 4 additions & 3 deletions cmd/press_open_im.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
package main

import (
"errors"
"flag"
"github.com/openimsdk/openim-sdk-core/v3/pkg/log"
"github.com/OpenIMSDK/tools/log"
"github.com/openimsdk/openim-sdk-core/v3/test"
)

Expand All @@ -30,8 +31,8 @@ func main() {
flag.Parse()
// test.InitMgr(*senderNum)

log.NewPrivateLog("", uint32(test.LogLevel))
log.Warn("", "press test begin, sender num: ", *senderNum, " single sender msg num: ", *singleSenderMsgNum, " send msg total num: ", *senderNum**singleSenderMsgNum)
log.ZInfo(ctx, "logLevel", uint32(test.LogLevel))
log.ZWarn(ctx, "press test begin ", errors.New(""), "sender num", *senderNum, " single sender msg num", *singleSenderMsgNum, " send msg total num ", *senderNum**singleSenderMsgNum)
test.PressTest(*singleSenderMsgNum, *intervalTime, *senderNum)
select {}
}
8 changes: 5 additions & 3 deletions cmd/reliability_open_im.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
package main

import (
"errors"
"flag"
"github.com/openimsdk/openim-sdk-core/v3/pkg/log"
"github.com/OpenIMSDK/tools/log"
"github.com/openimsdk/openim-sdk-core/v3/test"
)

Expand All @@ -30,7 +31,8 @@ func main() {
intervalTime = flag.Int("t", 10, "interval time mill second")
flag.Parse()
test.InitMgr(*senderNum)
log.NewPrivateLog(test.LogName, test.LogLevel)
log.Warn("", "reliability test start, sender num: ", *senderNum, " single sender msg num: ", *singleSenderMsgNum, " send msg total num: ", *senderNum**singleSenderMsgNum)
log.ZInfo(ctx, "logName", test.LogName, "logLevel", uint32(test.LogLevel))
log.ZWarn(ctx, "reliability test start ", errors.New(""), "sender num", *senderNum, " single sender msg num", *singleSenderMsgNum, " send msg total num ", *senderNum**singleSenderMsgNum)

test.ReliabilityTest(*singleSenderMsgNum, *intervalTime, 10, *senderNum)
}
11 changes: 6 additions & 5 deletions cmd/sk_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
package main

import (
"errors"
"github.com/OpenIMSDK/tools/log"
"github.com/openimsdk/openim-sdk-core/v3/pkg/db"
"github.com/openimsdk/openim-sdk-core/v3/pkg/log"
"github.com/openimsdk/openim-sdk-core/v3/pkg/utils"
"github.com/openimsdk/openim-sdk-core/v3/test"
"time"
Expand Down Expand Up @@ -127,10 +128,10 @@ func main() {
if i == 10000 {
break
}
log.Warn("", "10 * time.Millisecond ###################waiting... msg: ", i)
log.ZWarn(ctx, "", errors.New(""), "10 * time.Millisecond ###################waiting... msg: ", i)
}

log.Warn("", "cost time: ", utils.GetCurrentTimestampBySecond()-b)
//log.Warn("", "cost time: ", utils.GetCurrentTimestampBySecond()-b)
time.Sleep(100000 * time.Second)
return
i = 0
Expand All @@ -141,15 +142,15 @@ func main() {
if i == 10 {
break
}
log.Warn("", "1000 * time.Millisecond ###################waiting... msg: ", i)
log.ZWarn(ctx, "", errors.New(""), "1000 * time.Millisecond ###################waiting... msg: ", i)
}

i = 0
for {
test.DoTestSendMsg2Group(strMyUidx, "42c9f515cb84ee0e82b3f3ce71eb14d6", i)
i++
time.Sleep(10000 * time.Millisecond)
log.Warn("", "10000 * time.Millisecond ###################waiting... msg: ", i)
log.ZWarn(ctx, "", errors.New(""), "10000 * time.Millisecond ###################waiting... msg: ", i)
}

//reliabilityTest()
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ module github.com/openimsdk/openim-sdk-core/v3
go 1.18

require (
github.com/antonfisher/nested-logrus-formatter v1.3.1
github.com/golang/protobuf v1.5.3
github.com/gorilla/websocket v1.4.2
github.com/jinzhu/copier v0.3.5
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect
github.com/mitchellh/mapstructure v1.5.0
github.com/pkg/errors v0.9.1
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/sirupsen/logrus v1.9.2
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20220106031843-2efeb10ca2f6
google.golang.org/protobuf v1.31.0 // indirect
gorm.io/driver/sqlite v1.3.6
Expand Down
9 changes: 0 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ github.com/OpenIMSDK/protocol v0.0.40 h1:1/Oij6RSAaePCPrWGwp9Cyz976/8Uxr94hM5M5F
github.com/OpenIMSDK/protocol v0.0.40/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y=
github.com/OpenIMSDK/tools v0.0.5 h1:yBVHJ3EpIDcp8VFKPjuGr6MQvFa3t4JByZ+vmeC06/Q=
github.com/OpenIMSDK/tools v0.0.5/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI=
github.com/antonfisher/nested-logrus-formatter v1.3.1 h1:NFJIr+pzwv5QLHTPyKz9UMEoHck02Q9L0FP13b/xSbQ=
github.com/antonfisher/nested-logrus-formatter v1.3.1/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
Expand Down Expand Up @@ -83,14 +81,9 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo=
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20220106031843-2efeb10ca2f6 h1:SLcMxS3gIswMN5mHHeVo+85lHBau10lZmrZ3Ukji510=
github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20220106031843-2efeb10ca2f6/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw=
Expand All @@ -113,7 +106,6 @@ golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand All @@ -133,7 +125,6 @@ google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gorm.io/driver/sqlite v1.3.6 h1:Fi8xNYCUplOqWiPa3/GuCeowRNBRGTf62DEmhMDHeQQ=
gorm.io/driver/sqlite v1.3.6/go.mod h1:Sg1/pvnKtbQ7jLXxfZa+jSHvoX8hoZA8cn4xllOMTgE=
Expand Down
2 changes: 1 addition & 1 deletion msgtest/module/api_msg_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package module
import (
"fmt"
"github.com/openimsdk/openim-sdk-core/v3/pkg/constant"
"github.com/openimsdk/openim-sdk-core/v3/pkg/utils"
"github.com/openimsdk/openim-sdk-core/v3/sdk_struct"
"github.com/openimsdk/openim-sdk-core/v3/ws_wrapper/utils"

"github.com/OpenIMSDK/protocol/msg"
"github.com/OpenIMSDK/protocol/sdkws"
Expand Down
45 changes: 0 additions & 45 deletions pkg/log/file_line_hk.go

This file was deleted.

Loading

0 comments on commit 1508957

Please sign in to comment.