Add comprehensive logging system for debugging

- Create LoggingService that writes to Documents/Logs directory
- Log to both console and file with timestamps
- Replace debug print statements with bitchatLog()
- Add log file location display in AppInfoView
- Enable opening log file in Finder on macOS
- Track room member operations and view state
- Persist logs for debugging room member display issues
This commit is contained in:
jack
2025-07-05 19:35:37 +02:00
parent 4a834ac571
commit 22e02633b5
5 changed files with 167 additions and 25 deletions
+4 -4
View File
@@ -601,9 +601,9 @@ struct ContentView: View {
if let currentRoom = viewModel.currentRoom,
let roomMemberIDs = viewModel.roomMembers[currentRoom] {
// Show only peers who have sent messages to this room (including self)
print("[DEBUG-VIEW] Room \(currentRoom) has members: \(roomMemberIDs)")
print("[DEBUG-VIEW] Connected peers: \(viewModel.connectedPeers)")
print("[DEBUG-VIEW] My peer ID: \(myPeerID)")
bitchatLog("Room \(currentRoom) has members: \(roomMemberIDs)", category: "view")
bitchatLog("Connected peers: \(viewModel.connectedPeers)", category: "view")
bitchatLog("My peer ID: \(myPeerID)", category: "view")
// Start with room members who are also connected
var memberPeers = viewModel.connectedPeers.filter { roomMemberIDs.contains($0) }
@@ -613,7 +613,7 @@ struct ContentView: View {
memberPeers.append(myPeerID)
}
print("[DEBUG-VIEW] Peers to show in room: \(memberPeers)")
bitchatLog("Peers to show in room: \(memberPeers)", category: "view")
return memberPeers
} else {
// Show all connected peers in main chat