From ef46abd19364e2b1abf5226bac078cbb7a3a90fa Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Sun, 28 Jul 2024 11:18:23 +0800 Subject: [PATCH] chore: add Warn log in writePongMsg. (#2452) * update protocol in go mod. * add debug log in writePongMsg. * update log level. * add Warn log in writePongMsg. * add debug log. --- internal/msggateway/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/msggateway/client.go b/internal/msggateway/client.go index ded830c43..9fd71d989 100644 --- a/internal/msggateway/client.go +++ b/internal/msggateway/client.go @@ -393,6 +393,7 @@ func (c *Client) writePingMsg() error { func (c *Client) writePongMsg(appData string) error { log.ZDebug(c.ctx, "write Pong Msg in Server", "appData", appData) if c.closed.Load() { + log.ZWarn(c.ctx, "is closed in server", nil, "appdata", appData, "closed err", c.closedErr) return nil } @@ -403,6 +404,7 @@ func (c *Client) writePongMsg(appData string) error { log.ZDebug(c.ctx, "write Pong Msg in Server", "appData", appData) err := c.conn.SetWriteDeadline(writeWait) if err != nil { + log.ZWarn(c.ctx, "SetWriteDeadline in Server have error", errs.Wrap(err), "writeWait", writeWait, "appData", appData) return errs.Wrap(err) } err = c.conn.WriteMessage(PongMessage, []byte(appData)) @@ -410,5 +412,6 @@ func (c *Client) writePongMsg(appData string) error { log.ZWarn(c.ctx, "Write Message have error", errs.Wrap(err), "Pong msg", PongMessage) } + log.ZDebug(c.ctx, "write message is success", "appdata", appData, "closed err", c.closedErr) return errs.Wrap(err) }