Skip to content

Commit

Permalink
Add tracing for incoming messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
H-M-H committed Sep 27, 2024
1 parent cad8cde commit e59a375
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::sync::{mpsc, Arc};
use std::thread::{spawn, JoinHandle};
use std::time::{Duration, Instant};
use tokio::sync::mpsc::channel;
use tracing::{debug, error, warn};
use tracing::{debug, error, trace, warn};

use crate::capturable::{get_capturables, Capturable, Recorder};
use crate::input::device::{InputDevice, InputDeviceType};
Expand Down Expand Up @@ -105,19 +105,22 @@ impl<S, R, FnUInput> WeylusClientHandler<S, R, FnUInput> {
{
for message in self.receiver.take().unwrap() {
match message {
Ok(message) => match message {
MessageInbound::PointerEvent(event) => self.process_pointer_event(&event),
MessageInbound::WheelEvent(event) => self.process_wheel_event(&event),
MessageInbound::KeyboardEvent(event) => self.process_keyboard_event(&event),
MessageInbound::GetCapturableList => self.send_capturable_list(),
MessageInbound::Config(config) => self.update_config(config),
MessageInbound::PauseVideo => {
self.video_sender.send(VideoCommands::Pause).unwrap()
}
MessageInbound::ResumeVideo => {
self.video_sender.send(VideoCommands::Resume).unwrap()
Ok(message) => {
trace!("Received message: {message:?}");
match message {
MessageInbound::PointerEvent(event) => self.process_pointer_event(&event),
MessageInbound::WheelEvent(event) => self.process_wheel_event(&event),
MessageInbound::KeyboardEvent(event) => self.process_keyboard_event(&event),
MessageInbound::GetCapturableList => self.send_capturable_list(),
MessageInbound::Config(config) => self.update_config(config),
MessageInbound::PauseVideo => {
self.video_sender.send(VideoCommands::Pause).unwrap()
}
MessageInbound::ResumeVideo => {
self.video_sender.send(VideoCommands::Resume).unwrap()
}
}
},
}
Err(err) => {
warn!("Failed to read message {err}!");
self.send_message(MessageOutbound::Error(
Expand Down

0 comments on commit e59a375

Please sign in to comment.