[logging] tiny improvements, still the WASM stacktrace error

This commit is contained in:
ddidderr 2024-11-12 22:56:49 +01:00
parent 1388bc2115
commit ff0cee58d5
Signed by: ddidderr
GPG Key ID: 3841F1C27E6F0E14
2 changed files with 13 additions and 13 deletions

View File

@ -91,24 +91,20 @@ pub async fn run(
log::error!("failed to send request to server {:?}", e); log::error!("failed to send request to server {:?}", e);
} }
let mut all_data: Vec<u8> = Vec::new(); let mut data: Vec<u8> = Vec::new();
while let Ok(Some(data)) = rx.receive().await { while let Ok(Some(bytes)) = rx.receive().await {
log::trace!("msg from server (raw): {}", String::from_utf8_lossy(&data)); data.extend_from_slice(&bytes);
all_data.extend_from_slice(&data);
} }
log::debug!("{} bytes received from server", all_data.len()); log::debug!("{} bytes received from server", data.len());
log::trace!( log::trace!("server response (RAW): {}", String::from_utf8_lossy(&data));
"server response (RAW): {}",
String::from_utf8_lossy(&all_data)
);
let response = Response::decode(&all_data); let response = Response::decode(&data);
log::trace!("server response (DECODED): {response:?}"); log::trace!("server response (DECODED): {response:?}");
match response { match response {
Response::Games(games) => { Response::Games(games) => {
for game in &games { for game in &games {
log::debug!("{game:?}"); log::debug!("{game}");
} }
if let Err(e) = tx_notify_ui.send(ClientEvent::ListGames(games)) { if let Err(e) = tx_notify_ui.send(ClientEvent::ListGames(games)) {

View File

@ -108,10 +108,14 @@ pub fn run() {
let app_handle = app.handle().clone(); let app_handle = app.handle().clone();
tauri::async_runtime::spawn(async move { tauri::async_runtime::spawn(async move {
while let Some(event) = rx_client_event.recv().await { while let Some(event) = rx_client_event.recv().await {
log::debug!("Received client event");
match event { match event {
ClientEvent::ListGames(games) => { ClientEvent::ListGames(games) => {
log::debug!("Received client event: ListGames");
for game in &games {
log::trace!("client event ListGames iter: {game:?}");
}
if let Err(e) = app_handle.emit("games-list-updated", Some(games)) { if let Err(e) = app_handle.emit("games-list-updated", Some(games)) {
log::error!("Failed to emit games-list-updated event: {e}"); log::error!("Failed to emit games-list-updated event: {e}");
} else { } else {