Clean backend debug logging and standardize error reporting.
This removes verbose trace output in handlers/services and keeps only actionable error-level logs.
This commit is contained in:
@@ -293,7 +293,6 @@ func (m *WebSocketManager) IsUserOnline(userID string) bool {
|
||||
m.mutex.RLock()
|
||||
defer m.mutex.RUnlock()
|
||||
_, ok := m.clients[userID]
|
||||
log.Printf("[DEBUG IsUserOnline] 检查用户 %s, 结果=%v, 当前在线用户=%v", userID, ok, m.clients)
|
||||
return ok
|
||||
}
|
||||
|
||||
@@ -305,9 +304,6 @@ func (m *WebSocketManager) sendMessage(broadcast *BroadcastMessage) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG WebSocket] sendMessage: 目标用户=%s, 当前在线用户数=%d, 消息类型=%s",
|
||||
broadcast.TargetUser, len(m.clients), broadcast.Message.Type)
|
||||
|
||||
m.mutex.RLock()
|
||||
defer m.mutex.RUnlock()
|
||||
|
||||
@@ -324,7 +320,6 @@ func (m *WebSocketManager) sendMessage(broadcast *BroadcastMessage) {
|
||||
|
||||
select {
|
||||
case client.Send <- msgBytes:
|
||||
log.Printf("[DEBUG WebSocket] 成功发送消息到用户 %s, 消息类型=%s", userID, broadcast.Message.Type)
|
||||
default:
|
||||
log.Printf("Failed to send message to user %s: channel full", userID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user