Skip to content

Commit

Permalink
cleanup logs (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom authored Apr 18, 2024
1 parent fe22b48 commit 9c6a9b2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
4 changes: 2 additions & 2 deletions livekit-ffi/src/server/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl RoomInner {
break; // Event was sent
}

log::info!("waiting for the LocalTrackUnpublished event to be sent");
log::debug!("waiting for the LocalTrackUnpublished event to be sent");
tokio::time::sleep(tokio::time::Duration::from_millis(50)).await;
}
}
Expand Down Expand Up @@ -512,7 +512,7 @@ async fn forward_event(
if inner.pending_published_tracks.lock().remove(&sid) {
break;
}
log::info!("waiting for the PublishTrack callback to be sent");
log::debug!("waiting for the PublishTrack callback to be sent");
tokio::time::sleep(tokio::time::Duration::from_millis(50)).await;
}
}
Expand Down
14 changes: 4 additions & 10 deletions livekit/src/room/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ impl Room {
let dispatcher = dispatcher.clone();
let e2ee_manager = e2ee_manager.clone();
move |participant, publication| {
log::info!("local track published: {}", publication.sid());
log::debug!("local track published: {}", publication.sid());
let track = publication.track().unwrap();
let event = RoomEvent::LocalTrackPublished {
participant: participant.clone(),
Expand All @@ -303,7 +303,7 @@ impl Room {
let dispatcher = dispatcher.clone();
let e2ee_manager = e2ee_manager.clone();
move |participant, publication| {
log::info!("local track unpublished: {}", publication.sid());
log::debug!("local track unpublished: {}", publication.sid());
let event = RoomEvent::LocalTrackUnpublished {
participant: participant.clone(),
publication: publication.clone(),
Expand Down Expand Up @@ -369,7 +369,6 @@ impl Room {
move |participant_identity, state| {
// Forward e2ee events to the room
// (Ignore if the participant is not in the room anymore)
log::info!("e2ee state changed for {}: {:?}", participant_identity, state);

let participant = if participant_identity.as_str()
== inner.local_participant.identity().as_str()
Expand Down Expand Up @@ -605,7 +604,6 @@ impl RoomSession {
/// It'll create, update or remove a participant
/// It also update the participant tracks.
fn handle_participant_update(self: &Arc<Self>, updates: Vec<proto::ParticipantInfo>) {
log::info!("participant update: {:?}", updates);
for pi in updates {
let participant_sid = pi.sid.clone().try_into().unwrap();
let participant_identity: ParticipantIdentity = pi.identity.clone().into();
Expand Down Expand Up @@ -639,7 +637,6 @@ impl RoomSession {
remote_participant.update_info(pi.clone());
} else {
// Create a new participant
log::info!("new participant: {}", pi.sid);
let remote_participant = {
let pi = pi.clone();
self.create_participant(
Expand Down Expand Up @@ -820,7 +817,7 @@ impl RoomSession {
data_channels: dcs,
};

log::info!("sending sync state {:?}", sync_state);
log::debug!("sending sync state {:?}", sync_state);
self.rtc_engine.send_request(proto::signal_request::Message::SyncState(sync_state)).await;
}

Expand Down Expand Up @@ -943,7 +940,7 @@ impl RoomSession {
}

fn handle_disconnected(&self, reason: DisconnectReason) {
log::info!("disconnected from room: {:?}", reason);
log::debug!("disconnected from room: {:?}", reason);
if self.update_connection_state(ConnectionState::Disconnected) {
self.dispatcher.dispatch(&RoomEvent::Disconnected { reason });
}
Expand Down Expand Up @@ -1037,7 +1034,6 @@ impl RoomSession {
let dispatcher = self.dispatcher.clone();
let e2ee_manager = self.e2ee_manager.clone();
move |participant, publication, track| {
log::info!("track subscribed: {}", track.sid());
let event = RoomEvent::TrackSubscribed {
participant: participant.clone(),
track: track.clone(),
Expand All @@ -1052,7 +1048,6 @@ impl RoomSession {
let dispatcher = self.dispatcher.clone();
let e2ee_manager = self.e2ee_manager.clone();
move |participant, publication, track| {
log::info!("track unsubscribed: {}", track.sid());
let event = RoomEvent::TrackUnsubscribed {
participant: participant.clone(),
track: track.clone(),
Expand Down Expand Up @@ -1116,7 +1111,6 @@ impl RoomSession {
/// A participant has disconnected
/// Cleanup the participant and emit an event
fn handle_participant_disconnect(self: Arc<Self>, remote_participant: RemoteParticipant) {
log::info!("handle_participant_disconnect: {}", remote_participant.sid());
for (sid, _) in remote_participant.tracks() {
remote_participant.unpublish_track(&sid);
}
Expand Down
4 changes: 2 additions & 2 deletions livekit/src/rtc_engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ impl EngineInner {
async fn on_session_event(self: &Arc<Self>, event: SessionEvent) -> EngineResult<()> {
match event {
SessionEvent::Close { source, reason, can_reconnect, retry_now, full_reconnect } => {
log::info!("received session close: {}, {:?}", source, reason);
log::debug!("received session close: {}, {:?}", source, reason);
if can_reconnect {
self.reconnection_needed(retry_now, full_reconnect);
} else {
Expand Down Expand Up @@ -499,7 +499,7 @@ impl EngineInner {

tokio::select! {
_ = &mut close_receiver => {
log::info!("reconnection cancelled");
log::debug!("reconnection cancelled");
return;
}
res = inner.reconnect_task() => {
Expand Down
3 changes: 1 addition & 2 deletions livekit/src/rtc_engine/rtc_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use libwebrtc::{self as rtc, prelude::*};
use livekit_protocol as proto;
use log::error;
use tokio::sync::mpsc;

use super::peer_transport::PeerTransport;
Expand Down Expand Up @@ -108,7 +107,7 @@ fn on_ice_candidate_error(
_emitter: RtcEmitter,
) -> rtc::peer_connection::OnIceCandidateError {
Box::new(move |ice_error| {
error!("{:?}", ice_error);
log::debug!("{:?}", ice_error);
})
}

Expand Down
4 changes: 2 additions & 2 deletions livekit/src/rtc_engine/rtc_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl RtcSession {
let (signal_client, join_response, signal_events) =
SignalClient::connect(url, token, options.signal_options.clone()).await?;
let signal_client = Arc::new(signal_client);
log::info!("received JoinResponse: {:?}", join_response);
log::debug!("received JoinResponse: {:?}", join_response);

let (rtc_emitter, rtc_events) = mpsc::unbounded_channel();
let rtc_config = make_rtc_config_join(join_response.clone(), options.rtc_config.clone());
Expand Down Expand Up @@ -825,7 +825,7 @@ impl SessionInner {
/// ['RTCEngine']
async fn restart(&self) -> EngineResult<proto::ReconnectResponse> {
let reconnect_response = self.signal_client.restart().await?;
log::info!("received reconnect response: {:?}", reconnect_response);
log::debug!("received reconnect response: {:?}", reconnect_response);

let rtc_config =
make_rtc_config_reconnect(reconnect_response.clone(), self.options.rtc_config.clone());
Expand Down

0 comments on commit 9c6a9b2

Please sign in to comment.