diff --git a/go.mod b/go.mod index 3ddb274..2ddc67f 100644 --- a/go.mod +++ b/go.mod @@ -3,21 +3,23 @@ module clickandjoin.app/serversenteventsserver go 1.19 require ( - git.clickandjoin.umbach.dev/ClickandJoin/go-rabbitmq-client v1.0.24 // indirect + git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.36 + github.com/gofiber/fiber/v2 v2.40.1 + github.com/google/uuid v1.3.0 + github.com/rabbitmq/amqp091-go v1.5.0 + github.com/valyala/fasthttp v1.41.0 + gopkg.in/yaml.v2 v2.4.0 +) + +require ( github.com/andybalholm/brotli v1.0.4 // indirect - github.com/gofiber/adaptor/v2 v2.1.30 // indirect - github.com/gofiber/fiber/v2 v2.40.1 // indirect - github.com/google/uuid v1.3.0 // indirect github.com/klauspost/compress v1.15.9 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/rabbitmq/amqp091-go v1.5.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect - github.com/sirupsen/logrus v1.9.0 // indirect + github.com/rs/zerolog v1.29.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasthttp v1.41.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect - golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + golang.org/x/sys v0.5.0 // indirect ) diff --git a/go.sum b/go.sum index 829e2df..b36ab44 100644 --- a/go.sum +++ b/go.sum @@ -1,35 +1,39 @@ -git.clickandjoin.umbach.dev/ClickandJoin/go-rabbitmq-client v1.0.23 h1:FYMFWE9gXAXtvLzyVmv9yp/AmQos1OfTuVZy6DnQrEw= -git.clickandjoin.umbach.dev/ClickandJoin/go-rabbitmq-client v1.0.23/go.mod h1:KPbHNtFhttE/TtXZcorq6LKpCigkTaF0qzmB2p7nFsg= -git.clickandjoin.umbach.dev/ClickandJoin/go-rabbitmq-client v1.0.24 h1:rvBwQLc5keM6kkAGL9qNQiOlvT5GDfgnYDn3viHVDR8= -git.clickandjoin.umbach.dev/ClickandJoin/go-rabbitmq-client v1.0.24/go.mod h1:KPbHNtFhttE/TtXZcorq6LKpCigkTaF0qzmB2p7nFsg= +git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.36 h1:tqx39cmvtID3lbjvUbN6Vv2Xt16fXQSwnxiw4esMqnQ= +git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper v1.0.36/go.mod h1:RnqJsFYGR0cdxbeQjB1dDlr/MeKgnMkc7XoZtFDhMbo= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gofiber/adaptor/v2 v2.1.30 h1:ak5sCY8HbnafdMjvxUhS8wz5JWghwfxhnvig3/ACjVo= -github.com/gofiber/adaptor/v2 v2.1.30/go.mod h1:20KxTjpAea1f+9mcMwManJWKvWl37YxW1yuNGoNoGS4= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofiber/fiber/v2 v2.40.1 h1:pc7n9VVpGIqNsvg9IPLQhyFEMJL8gCs1kneH5D1pIl4= github.com/gofiber/fiber/v2 v2.40.1/go.mod h1:Gko04sLksnHbzLSRBFWPFdzM9Ws9pRxvvIaohJK1dsk= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rabbitmq/amqp091-go v1.5.0 h1:VouyHPBu1CrKyJVfteGknGOGCzmOz0zcv/tONLkb7rg= github.com/rabbitmq/amqp091-go v1.5.0/go.mod h1:JsV0ofX5f1nwOGafb8L5rBItt9GyhfQfcJj+oyz0dGg= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w= +github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= @@ -39,6 +43,7 @@ github.com/valyala/fasthttp v1.41.0/go.mod h1:f6VbjjoI3z1NDOZOv17o6RvtRSWxC77seB github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -60,11 +65,12 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -79,6 +85,7 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/main.go b/main.go index ac75de2..b976aa1 100644 --- a/main.go +++ b/main.go @@ -10,21 +10,17 @@ import ( "clickandjoin.app/serversenteventsserver/modules/config" "clickandjoin.app/serversenteventsserver/modules/rabbitmq" "clickandjoin.app/serversenteventsserver/modules/structs" + gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" "github.com/google/uuid" - "github.com/sirupsen/logrus" "github.com/valyala/fasthttp" ) func init() { config.LoadConfig() - if config.Cfg.Debug { - logrus.SetLevel(logrus.DebugLevel) - } - - logrus.Println("Debug:", config.Cfg.Debug) + gocnjhelper.InitLogger(config.Cfg.Debug, true, true) go rabbitmq.Init() } @@ -37,7 +33,7 @@ func main() { time.Sleep(500 * time.Millisecond) if len(os.Args) < 2 { - logrus.Fatalln("Please specify port") + gocnjhelper.LogFatal("Please specify port") } // TODO: origin @@ -63,8 +59,8 @@ func main() { cache.SSEClients[clientId] = sseclient - logrus.Debugln("NEW CLIENT ID:", clientId) - logrus.Debugln(len(cache.SSEClients), "CLIENTS CONNECTED") + gocnjhelper.LogDebugf("NEW CLIENT ID: %s", clientId) + gocnjhelper.LogDebugf("%d CLIENTS CONNECTED", len(cache.SSEClients)) for message := range sseclient.MessageChan { fmt.Fprintf(w, "data: %s\n\n", message.Message) @@ -80,7 +76,7 @@ func main() { if id == message.ClientId { close(sseClient.MessageChan) delete(cache.SSEClients, id) - logrus.Debugln("DELETE clientId:", id) + gocnjhelper.LogDebugf("DELETE clientId: %s", id) } } } diff --git a/modules/config/config.go b/modules/config/config.go index acc6981..a6fc268 100644 --- a/modules/config/config.go +++ b/modules/config/config.go @@ -3,7 +3,7 @@ package config import ( "os" - "github.com/sirupsen/logrus" + gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper" "gopkg.in/yaml.v2" ) @@ -24,10 +24,10 @@ func LoadConfig() { data, err := os.ReadFile("config.yml") if err != nil { - logrus.Fatalln("Failed to read config file, err:", err) + gocnjhelper.LogFatalf("Failed to read config file, err: %s", err) } if err := yaml.Unmarshal(data, &Cfg); err != nil { - logrus.Fatalln("Failed to unmarshal config file, err:", err) + gocnjhelper.LogFatalf("Failed to unmarshal config file, err: %s", err) } } diff --git a/modules/rabbitmq/helper.go b/modules/rabbitmq/helper.go index 54a8a57..33c5bf2 100644 --- a/modules/rabbitmq/helper.go +++ b/modules/rabbitmq/helper.go @@ -4,16 +4,15 @@ import ( "clickandjoin.app/serversenteventsserver/modules/cache" "clickandjoin.app/serversenteventsserver/modules/structs" "clickandjoin.app/serversenteventsserver/modules/utils" - gorabbitmqclient "git.clickandjoin.umbach.dev/ClickandJoin/go-rabbitmq-client" + gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper" amqp "github.com/rabbitmq/amqp091-go" - "github.com/sirupsen/logrus" ) func ApiBroadcastMessagesHandling() { msgs, err := apiBroadcastMessagesConsumer() if err != nil { - logrus.Errorln("Failed to create api broadcast message consumer, err:", err) + gocnjhelper.LogErrorf("Failed to create api broadcast message consumer, err: %s", err) return } @@ -34,7 +33,7 @@ func ApiBroadcastMessagesHandling() { continue } - logrus.Debugln("Re-set api broadcast channel") + gocnjhelper.LogDebug("Re-set api broadcast channel") // Re-set channel to receive notifications // The library closes this channel after abnormal shutdown @@ -47,11 +46,11 @@ func ApiBroadcastMessagesHandling() { err = utils.UnmarshalReceivedMessage(msg.Body, &receivedMessage) if err != nil { - logrus.Errorln("Failed to unmarshal received msg, err:", err) + gocnjhelper.LogErrorf("Failed to unmarshal received msg, err: %s", err) } - logrus.Debugln("RABBITMQ RECEIVED BROADCAST MESSAGE:", receivedMessage) - logrus.Debugln("SENDING MSG TO", len(cache.SSEClients), "CLIENTS") + gocnjhelper.LogDebugf("RABBITMQ RECEIVED BROADCAST MESSAGE: %s", receivedMessage) + gocnjhelper.LogDebugf("SENDING MSG TO %s %s", len(cache.SSEClients), "CLIENTS") for id, sseClient := range cache.SSEClients { sseClient.MessageChan <- structs.SSEClientChanMessage{ClientId: id, Message: string(msg.Body)} @@ -62,7 +61,7 @@ func ApiBroadcastMessagesHandling() { } func apiBroadcastMessagesConsumer() (msgs <-chan amqp.Delivery, err error) { - return ApiBroadcastClient.ConsumeChannelMessages(gorabbitmqclient.ChannelConsumeSettings{ + return ApiBroadcastClient.ConsumeChannelMessages(gocnjhelper.ChannelConsumeSettings{ QueueName: ApiBroadcastClient.AssignedQueueName, Consumer: "", AutoAck: true, diff --git a/modules/rabbitmq/rabbitmq.go b/modules/rabbitmq/rabbitmq.go index 6f4dc1a..17c6753 100644 --- a/modules/rabbitmq/rabbitmq.go +++ b/modules/rabbitmq/rabbitmq.go @@ -4,12 +4,12 @@ import ( "time" "clickandjoin.app/serversenteventsserver/modules/config" - gorabbitmqclient "git.clickandjoin.umbach.dev/ClickandJoin/go-rabbitmq-client" + gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper" ) const exchangeBroadcastMessages = "cnj.api.broadcast.messages" -var ApiBroadcastClient *gorabbitmqclient.Client +var ApiBroadcastClient *gocnjhelper.Client func Init() { cfg := config.Cfg @@ -17,10 +17,9 @@ func Init() { /* * api broadcast messages */ - ApiBroadcastClient = gorabbitmqclient.NewClient( - cfg.Debug, - gorabbitmqclient.ExchangeSettings{}, - gorabbitmqclient.QueueSettings{ + ApiBroadcastClient = gocnjhelper.NewClient( + gocnjhelper.ExchangeSettings{}, + gocnjhelper.QueueSettings{ Enabled: true, Name: "", Durable: false, @@ -28,22 +27,22 @@ func Init() { Exclusive: true, NoWait: false, Arguments: nil, - QueueBindSettings: gorabbitmqclient.QueueBindSettings{ + QueueBindSettings: gocnjhelper.QueueBindSettings{ Enabled: true, - QueueName: gorabbitmqclient.SetQueueNameToAutomaticallyAssignedQueueName, + QueueName: gocnjhelper.SetQueueNameToAutomaticallyAssignedQueueName, RoutingKey: "", Exchange: exchangeBroadcastMessages, NoWait: false, Arguments: nil, }, }, - gorabbitmqclient.ChannelQosSettingsDefault, - gorabbitmqclient.Config{ + gocnjhelper.ChannelQosSettingsDefault, + gocnjhelper.Config{ ReconnectDelay: 1 * time.Second, ReInitDelay: 1 * time.Second, ResendDelay: 5 * time.Second, }, - gorabbitmqclient.GetConnectionString( + gocnjhelper.GetConnectionString( cfg.RabbitMq.Username, cfg.RabbitMq.Password, cfg.RabbitMq.Host)) diff --git a/modules/utils/utils.go b/modules/utils/utils.go index 3c28159..617efa8 100644 --- a/modules/utils/utils.go +++ b/modules/utils/utils.go @@ -4,14 +4,14 @@ import ( "encoding/json" "clickandjoin.app/serversenteventsserver/modules/structs" - "github.com/sirupsen/logrus" + gocnjhelper "git.clickandjoin.umbach.dev/ClickandJoin/go-cnj-helper" ) func MarshalMessage(message any) (marshaledMessage []byte, err error) { marshaledMessage, err = json.Marshal(message) if err != nil { - logrus.Errorln("Failed to marshal send message, err:", err) + gocnjhelper.LogErrorf("Failed to marshal send message, err: %s", err) return nil, err } @@ -22,7 +22,7 @@ func UnmarshalReceivedMessage(body []byte, receivedMessage *structs.ReceivedMess err := json.Unmarshal(body, &receivedMessage) if err != nil { - logrus.Errorln("Failed to unmarshal received message, err:", err) + gocnjhelper.LogErrorf("Failed to unmarshal received message, err: %s", err) return err }