actually make logging work

This commit is contained in:
2024-11-11 14:09:05 -07:00
parent 2211be5324
commit 70fcd18690
3 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ futures-channel = "0.3.30"
sir = { git = "https://gitlab.com/samsartor/sir", features = ["dioxus"] } # dioxus 0.6 sir = { git = "https://gitlab.com/samsartor/sir", features = ["dioxus"] } # dioxus 0.6
mumble-web2-common = { workspace = true } mumble-web2-common = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["ansi"] } tracing-subscriber = { version = "0.3.18", features = ["ansi"] }
tracing = "0.1.40" tracing = "0.1.40"
color-eyre = "0.6.3" color-eyre = "0.6.3"
+7 -6
View File
@@ -25,6 +25,7 @@ use std::collections::HashMap;
use std::time::Duration; use std::time::Duration;
use tracing::debug; use tracing::debug;
use tracing::error; use tracing::error;
use tracing::info;
pub mod app; pub mod app;
pub mod imp; pub mod imp;
@@ -58,10 +59,10 @@ pub async fn network_loop<R: imp::ImpRead, W: imp::ImpWrite>(
spawn(async move { spawn(async move {
while let Some(msg) = writer_recv_chan.next().await { while let Some(msg) = writer_recv_chan.next().await {
if !matches!(msg, ControlPacket::Ping(_) | ControlPacket::UDPTunnel(_)) { if !matches!(msg, ControlPacket::Ping(_) | ControlPacket::UDPTunnel(_)) {
debug!("sending {:#?}", msg); info!("sending packet {:#?}", msg);
} }
if let Err(e) = writer.send(msg).await { if let Err(e) = writer.send(msg).await {
error!("error sending message {:?}", e); error!("error sending packet {:?}", e);
break; break;
} }
} }
@@ -73,7 +74,7 @@ pub async fn network_loop<R: imp::ImpRead, W: imp::ImpWrite>(
Some(Err(err)) => bail!("bad version packet: {err:?}"), Some(Err(err)) => bail!("bad version packet: {err:?}"),
None => bail!("no version was recieved"), None => bail!("no version was recieved"),
}; };
debug!("got version packet {:#?}", version); info!("got version packet {:#?}", version);
// Send version packet // Send version packet
let mut msg = msgs::Version::new(); let mut msg = msgs::Version::new();
@@ -117,7 +118,7 @@ pub async fn network_loop<R: imp::ImpRead, W: imp::ImpWrite>(
match packet { match packet {
Some(Ok(msg)) => { Some(Ok(msg)) => {
if !matches!(msg, ControlPacket::UDPTunnel(_) | ControlPacket::Ping(_)) { if !matches!(msg, ControlPacket::UDPTunnel(_) | ControlPacket::Ping(_)) {
debug!("receiving {:#?}", msg); info!("receiving packet {:#?}", msg);
} }
let res = accept_packet(msg, &mut audio, &mut decoder_map); let res = accept_packet(msg, &mut audio, &mut decoder_map);
if let Err(err) = res { if let Err(err) = res {
@@ -133,14 +134,14 @@ pub async fn network_loop<R: imp::ImpRead, W: imp::ImpWrite>(
command = command_future => { command = command_future => {
command_future = event_rx.next(); command_future = event_rx.next();
if let Some(command) = &command { if let Some(command) = &command {
debug!("commanding {:#?}", command); info!("issuing command {:#?}", command);
} }
match command { match command {
Some(Command::Disconnect) => break, Some(Command::Disconnect) => break,
Some(command) => { Some(command) => {
let res = accept_command(command, &mut send_chan); let res = accept_command(command, &mut send_chan);
if let Err(err) = res { if let Err(err) = res {
error!("error accepting command {:?}", err) info!("error accepting command {:?}", err)
} }
} }
None => continue, None => continue,
+2 -1
View File
@@ -1,4 +1,4 @@
use mumble_web2_gui::app; use mumble_web2_gui::{app, imp::init_logging};
pub fn main() { pub fn main() {
#[cfg(feature = "desktop")] #[cfg(feature = "desktop")]
@@ -7,5 +7,6 @@ pub fn main() {
.build() .build()
.unwrap() .unwrap()
.enter(); .enter();
init_logging();
dioxus::launch(app::app); dioxus::launch(app::app);
} }