[logging] tiny improvements, still the WASM stacktrace error
This commit is contained in:
parent
1388bc2115
commit
ff0cee58d5
@ -91,24 +91,20 @@ pub async fn run(
|
||||
log::error!("failed to send request to server {:?}", e);
|
||||
}
|
||||
|
||||
let mut all_data: Vec<u8> = Vec::new();
|
||||
while let Ok(Some(data)) = rx.receive().await {
|
||||
log::trace!("msg from server (raw): {}", String::from_utf8_lossy(&data));
|
||||
all_data.extend_from_slice(&data);
|
||||
let mut data: Vec<u8> = Vec::new();
|
||||
while let Ok(Some(bytes)) = rx.receive().await {
|
||||
data.extend_from_slice(&bytes);
|
||||
}
|
||||
log::debug!("{} bytes received from server", all_data.len());
|
||||
log::trace!(
|
||||
"server response (RAW): {}",
|
||||
String::from_utf8_lossy(&all_data)
|
||||
);
|
||||
log::debug!("{} bytes received from server", data.len());
|
||||
log::trace!("server response (RAW): {}", String::from_utf8_lossy(&data));
|
||||
|
||||
let response = Response::decode(&all_data);
|
||||
let response = Response::decode(&data);
|
||||
log::trace!("server response (DECODED): {response:?}");
|
||||
|
||||
match response {
|
||||
Response::Games(games) => {
|
||||
for game in &games {
|
||||
log::debug!("{game:?}");
|
||||
log::debug!("{game}");
|
||||
}
|
||||
|
||||
if let Err(e) = tx_notify_ui.send(ClientEvent::ListGames(games)) {
|
||||
|
@ -108,10 +108,14 @@ pub fn run() {
|
||||
let app_handle = app.handle().clone();
|
||||
tauri::async_runtime::spawn(async move {
|
||||
while let Some(event) = rx_client_event.recv().await {
|
||||
log::debug!("Received client event");
|
||||
|
||||
match event {
|
||||
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)) {
|
||||
log::error!("Failed to emit games-list-updated event: {e}");
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user