From 68985e9edae1d19672c26b5db1299856e6fa7a04 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 30 Dec 2021 10:30:47 +0800 Subject: [PATCH] log add --- internal/msg_gateway/gate/ws_server.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/msg_gateway/gate/ws_server.go b/internal/msg_gateway/gate/ws_server.go index 150a11b64..88fad8c0c 100644 --- a/internal/msg_gateway/gate/ws_server.go +++ b/internal/msg_gateway/gate/ws_server.go @@ -183,7 +183,7 @@ func (ws *WServer) addUserConn(uid string, platformID int32, conn *UserConn, tok for _, v := range ws.wsUserToConn { count = count + len(v) } - log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "uid", uid, "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) + log.WarnByKv("WS Add operation", "", "wsUser added", ws.wsUserToConn, "connection_uid", uid, "connection_platform", constant.PlatformIDToName(platformID), "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) } @@ -206,9 +206,9 @@ func (ws *WServer) delUserConn(conn *UserConn) { for _, v := range ws.wsUserToConn { count = count + len(v) } - log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "uid", uid, "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) + log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "disconnection_uid", uid, "disconnection_platform", platform, "online_user_num", len(ws.wsUserToConn), "online_conn_num", count) } else { - log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "uid", uid, "online_user_num", len(ws.wsUserToConn)) + log.WarnByKv("WS delete operation", "", "wsUser deleted", ws.wsUserToConn, "disconnection_uid", uid, "disconnection_platform", platform, "online_user_num", len(ws.wsUserToConn)) } delete(ws.wsConnToUser, conn) @@ -272,7 +272,6 @@ func (ws *WServer) headerCheck(w http.ResponseWriter, r *http.Request) bool { http.Error(w, http.StatusText(status), status) return false } - } func genMapKey(uid string, platformID int32) string { return uid + " " + constant.PlatformIDToName(platformID)