optimize logger info of real time data subscription api
This commit is contained in:
parent
a82e02126d
commit
b43adf9b67
|
|
@ -91,12 +91,10 @@ func readClientMessages(ctx context.Context, conn *websocket.Conn, clientID stri
|
|||
if websocket.IsCloseError(err, websocket.CloseNormalClosure) {
|
||||
logger.Info(ctx, "client actively and normally closed the connection", "client_id", clientID)
|
||||
} else if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
|
||||
// 这是您代码中已有的逻辑,用于处理非正常或服务器离开的关闭(如网络中断、浏览器关闭 Tab 但未发送关闭帧)。
|
||||
logger.Error(ctx, "clientID: %s 读取时发生错误: %v", clientID, err)
|
||||
logger.Error(ctx, "an unexpected error occurred while reading the webSocket connection", "client_id", clientID, "error", err)
|
||||
} else {
|
||||
// 处理其他读取错误(如 I/O 错误)
|
||||
logger.Error(ctx, "clientID: %s 读取时发生错误: %v", clientID, err)
|
||||
fmt.Printf("客户端 %s 读取时发生未知错误: %v\n", clientID, err)
|
||||
// handle other read errors (eg, I/O errors)
|
||||
logger.Error(ctx, "an error occurred while reading the webSocket connection", "client_id", clientID, "error", err)
|
||||
}
|
||||
cancel()
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in New Issue