Skip to content

Commit c36032f

Browse files
committed
fix: lower verbosity of routine logs in library crates
Library crates should not emit info! for routine, repeating operations; that floods the default logs of the final consumer, which owns the verbosity decision. Reserve info! for rare connection/session lifecycle milestones, debug! for significant one-off events, and trace! for the fine-grained detail only needed when nothing else explains a problem.
1 parent dca254d commit c36032f

7 files changed

Lines changed: 48 additions & 48 deletions

File tree

crates/ironrdp-cliprdr/src/lib.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use pdu::{
2020
FileContentsResponse, FileDescriptor, FormatDataRequest, FormatListResponse, LockDataId, OwnedFormatDataResponse,
2121
PackedFileList,
2222
};
23-
use tracing::{debug, error, info, trace, warn};
23+
use tracing::{debug, error, trace, warn};
2424

2525
#[rustfmt::skip] // do not reorder
2626
use crate::pdu::FormatList;
@@ -620,11 +620,11 @@ impl<R: Role> Cliprdr<R> {
620620
FormatListResponse::Ok => {
621621
if !R::is_server() {
622622
if self.state == CliprdrState::Initialization {
623-
info!("Clipboard virtual channel initialized");
623+
debug!("Clipboard virtual channel initialized");
624624
self.state = CliprdrState::Ready;
625625
self.backend.on_ready();
626626
} else {
627-
info!("Remote accepted format list");
627+
trace!("Remote accepted format list");
628628
}
629629
}
630630
self.backend.on_format_list_response(true);
@@ -640,7 +640,7 @@ impl<R: Role> Cliprdr<R> {
640640
self.local_drop_effect_format_id = None;
641641

642642
if !self.sent_file_contents_requests.is_empty() {
643-
info!(
643+
debug!(
644644
count = self.sent_file_contents_requests.len(),
645645
"Clearing pending file contents requests due to FormatListResponse::Fail"
646646
);
@@ -664,7 +664,7 @@ impl<R: Role> Cliprdr<R> {
664664

665665
fn handle_format_list(&mut self, format_list: FormatList<'_>) -> PduResult<Vec<SvcMessage>> {
666666
if R::is_server() && self.state == CliprdrState::Initialization {
667-
info!("Clipboard virtual channel initialized");
667+
debug!("Clipboard virtual channel initialized");
668668
self.state = CliprdrState::Ready;
669669
self.backend.on_ready();
670670
}
@@ -740,7 +740,7 @@ impl<R: Role> Cliprdr<R> {
740740
if let Some(format) = file_list_format {
741741
// Store the format ID for later use when user initiates paste
742742
self.remote_file_list_format_id = Some(format.id);
743-
info!(format_id = ?format.id, "FileGroupDescriptorW format available in FormatList");
743+
trace!(format_id = ?format.id, "FileGroupDescriptorW format available in FormatList");
744744
}
745745

746746
// [MS-RDPECLIP] 3.1.5.2.2 - Acknowledge the FormatList before any
@@ -830,7 +830,7 @@ impl<R: Role> Cliprdr<R> {
830830
} else {
831831
match self.state {
832832
CliprdrState::Ready => {
833-
info!("User initiated copy, sending format list");
833+
trace!("User initiated copy, sending format list");
834834
pdus.push(ClipboardPdu::FormatList(
835835
self.build_format_list(available_formats).map_err(|e| encode_err!(e))?,
836836
));
@@ -863,7 +863,7 @@ impl<R: Role> Cliprdr<R> {
863863
self.pending_format_data_request = Some(requested_format);
864864

865865
if Some(requested_format) == self.remote_file_list_format_id {
866-
info!(format_id = ?requested_format, "User initiated paste for FileGroupDescriptorW");
866+
trace!(format_id = ?requested_format, "User initiated paste for FileGroupDescriptorW");
867867
}
868868

869869
let pdu = ClipboardPdu::FormatDataRequest(FormatDataRequest {
@@ -972,7 +972,7 @@ impl<R: Role> Cliprdr<R> {
972972
self.outgoing_locks.insert(clip_data_id, lock);
973973
self.current_lock_id = Some(clip_data_id);
974974

975-
info!(clip_data_id, "Sent clipboard lock");
975+
trace!(clip_data_id, "Sent clipboard lock");
976976

977977
let pdu = ClipboardPdu::LockData(LockDataId(clip_data_id));
978978
Some(vec![into_cliprdr_message(pdu)])
@@ -1015,7 +1015,7 @@ impl<R: Role> Cliprdr<R> {
10151015
self.current_lock_id = None;
10161016

10171017
if !newly_expired.is_empty() {
1018-
info!(
1018+
debug!(
10191019
count = newly_expired.len(),
10201020
inactivity_timeout_secs = self.lock_inactivity_timeout.as_secs(),
10211021
max_lifetime_secs = self.lock_max_lifetime.as_secs(),
@@ -1052,7 +1052,7 @@ impl<R: Role> Cliprdr<R> {
10521052
self.outgoing_locks.clear();
10531053
self.current_lock_id = None;
10541054

1055-
info!(
1055+
debug!(
10561056
count = cleared.len(),
10571057
"Releasing outgoing locks before taking clipboard ownership"
10581058
);
@@ -1159,7 +1159,7 @@ impl<R: Role> Cliprdr<R> {
11591159

11601160
// Log cleanup summary
11611161
if !expired_ids.is_empty() {
1162-
info!(
1162+
debug!(
11631163
count = expired_ids.len(),
11641164
clip_data_ids = ?expired_ids,
11651165
"Automatic lock cleanup completed"
@@ -1202,7 +1202,7 @@ impl<R: Role> Cliprdr<R> {
12021202
}
12031203

12041204
if !stale_stream_ids.is_empty() {
1205-
info!(
1205+
debug!(
12061206
count = stale_stream_ids.len(),
12071207
"Stale file contents request cleanup completed"
12081208
);
@@ -1230,7 +1230,7 @@ impl<R: Role> Cliprdr<R> {
12301230
}
12311231

12321232
if !stale_lock_ids.is_empty() {
1233-
info!(count = stale_lock_ids.len(), "Upload inactivity cleanup completed");
1233+
debug!(count = stale_lock_ids.len(), "Upload inactivity cleanup completed");
12341234
}
12351235

12361236
Ok(messages.into())
@@ -1529,7 +1529,7 @@ impl<R: Role> Cliprdr<R> {
15291529
.collect();
15301530

15311531
if validated_files.len() < original_count {
1532-
info!(
1532+
debug!(
15331533
total = original_count,
15341534
valid = validated_files.len(),
15351535
"File list validation completed with warnings"
@@ -1632,7 +1632,7 @@ impl<R: Role> SvcProcessor for Cliprdr<R> {
16321632
}
16331633

16341634
if let Some(ref file_list) = self.local_file_list {
1635-
info!(clip_data_id = id.0, "Locking clipboard with file list snapshot");
1635+
debug!(clip_data_id = id.0, "Locking clipboard with file list snapshot");
16361636
self.locked_file_lists.insert(id.0, file_list.clone());
16371637
self.locked_file_list_activity.insert(id.0, self.backend.now_ms());
16381638
} else {
@@ -1652,7 +1652,7 @@ impl<R: Role> SvcProcessor for Cliprdr<R> {
16521652
// Release the file list snapshot associated with this clipDataId.
16531653
if self.locked_file_lists.remove(&id.0).is_some() {
16541654
self.locked_file_list_activity.remove(&id.0);
1655-
info!(
1655+
debug!(
16561656
clip_data_id = id.0,
16571657
"Unlocking clipboard and releasing file list snapshot"
16581658
);
@@ -1681,7 +1681,7 @@ impl<R: Role> SvcProcessor for Cliprdr<R> {
16811681
if Some(request.format) == self.local_file_list_format_id {
16821682
if let Some(ref file_list) = self.local_file_list {
16831683
// Respond with the stored file list
1684-
info!(
1684+
debug!(
16851685
format_id = ?request.format,
16861686
file_count = file_list.files.len(),
16871687
"Responding to FileGroupDescriptorW request with stored file list"
@@ -1752,7 +1752,7 @@ impl<R: Role> SvcProcessor for Cliprdr<R> {
17521752
}
17531753
}
17541754

1755-
info!(
1755+
debug!(
17561756
file_count = file_list.files.len(),
17571757
"Received FileGroupDescriptorW from remote"
17581758
);

crates/ironrdp-dvc-com-plugin/src/channel.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use ironrdp_core::impl_as_any;
1616
use ironrdp_dvc::{DvcClientProcessor, DvcMessage, DvcProcessor};
1717
use ironrdp_pdu::{PduResult, pdu_other_err};
1818
use ironrdp_svc::SvcMessage;
19-
use tracing::{debug, error, info, warn};
19+
use tracing::{debug, error, trace, warn};
2020
use windows::Win32::System::LibraryLoader::{GetProcAddress, LoadLibraryW};
2121
use windows::Win32::System::RemoteDesktop::{IWTSListenerCallback, IWTSPlugin, IWTSVirtualChannelManager};
2222
use windows::core::{HRESULT, PCSTR, PCWSTR};
@@ -62,7 +62,7 @@ impl DvcProcessor for DvcComChannel {
6262
}
6363

6464
fn start(&mut self, channel_id: u32) -> PduResult<Vec<DvcMessage>> {
65-
info!(
65+
debug!(
6666
channel_name = %self.channel_name,
6767
channel_id,
6868
"DVC COM channel start"
@@ -92,7 +92,7 @@ impl DvcProcessor for DvcComChannel {
9292
let accepted = accept_rx.recv().unwrap_or(false);
9393

9494
if accepted {
95-
info!(
95+
debug!(
9696
channel_name = %self.channel_name,
9797
channel_id,
9898
"COM plugin accepted DVC channel"
@@ -164,7 +164,7 @@ pub fn load_dvc_plugin<F>(dll_path: &Path, on_write_dvc_factory: F) -> PduResult
164164
where
165165
F: Fn() -> OnWriteDvcMessage + Send + Sync + 'static,
166166
{
167-
info!(dll = %dll_path.display(), "Loading DVC COM plugin");
167+
debug!(dll = %dll_path.display(), "Loading DVC COM plugin");
168168

169169
// Channel for sending commands to the COM worker thread
170170
let (command_tx, command_rx) = std_mpsc::channel();
@@ -185,7 +185,7 @@ where
185185
match initialize_plugin_on_thread(&dll_path_owned) {
186186
Ok((plugin, manager, listeners)) => {
187187
let channel_names: Vec<String> = listeners.keys().cloned().collect();
188-
info!(
188+
debug!(
189189
channels = ?channel_names,
190190
"Plugin initialized, registered {} listener(s)",
191191
channel_names.len()
@@ -256,7 +256,7 @@ fn initialize_plugin_on_thread(
256256
// SAFETY: loading the DLL into this process
257257
let hmodule = unsafe { LoadLibraryW(dll_path_pcwstr) }.map_err(|e| format!("LoadLibraryW failed: {e}"))?;
258258

259-
info!(dll = %dll_path.display(), "DLL loaded successfully");
259+
trace!(dll = %dll_path.display(), "DLL loaded successfully");
260260

261261
// Get the VirtualChannelGetInstance export
262262
let proc_name = PCSTR::from_raw(c"VirtualChannelGetInstance".as_ptr().cast::<u8>());
@@ -268,7 +268,7 @@ fn initialize_plugin_on_thread(
268268
// SAFETY: transmuting the function pointer; we trust the DLL follows the documented API
269269
let get_instance: VirtualChannelGetInstanceFn = unsafe { core::mem::transmute(proc_addr) };
270270

271-
info!("VirtualChannelGetInstance export found");
271+
trace!("VirtualChannelGetInstance export found");
272272

273273
// Phase 1: query the number of plugin objects
274274
let iid = IWTSPlugin::IID;
@@ -283,7 +283,7 @@ fn initialize_plugin_on_thread(
283283
));
284284
}
285285

286-
info!(count = num_objs, "Plugin reports {} object(s)", num_objs);
286+
trace!(count = num_objs, "Plugin reports {} object(s)", num_objs);
287287

288288
if num_objs == 0 {
289289
return Err("plugin returned 0 objects".to_owned());
@@ -311,7 +311,7 @@ fn initialize_plugin_on_thread(
311311
// SAFETY: the plugin pointer is a valid IWTSPlugin COM interface pointer
312312
let plugin: IWTSPlugin = unsafe { IWTSPlugin::from_raw(plugin_ptr) };
313313

314-
info!("Got IWTSPlugin COM object");
314+
trace!("Got IWTSPlugin COM object");
315315

316316
// Create shared state for listeners: we keep an Rc clone so we can read the
317317
// map after Initialize() without needing an unsafe cast from the COM pointer.
@@ -322,7 +322,7 @@ fn initialize_plugin_on_thread(
322322
// SAFETY: calling IWTSPlugin::Initialize with our channel manager
323323
unsafe { plugin.Initialize(&manager) }.map_err(|e| format!("IWTSPlugin::Initialize failed: {e}"))?;
324324

325-
info!("IWTSPlugin::Initialize succeeded");
325+
trace!("IWTSPlugin::Initialize succeeded");
326326

327327
// Read the listener map that the plugin populated during Initialize.
328328
let listeners: HashMap<String, IWTSListenerCallback> = listeners_rc.borrow().clone();

crates/ironrdp-dvc-com-plugin/src/worker.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use std::collections::HashMap;
88
use std::sync::mpsc as std_mpsc;
99

10-
use tracing::{debug, error, info, trace, warn};
10+
use tracing::{debug, error, trace, warn};
1111
use windows::Win32::System::RemoteDesktop::{
1212
IWTSListenerCallback, IWTSPlugin, IWTSVirtualChannel, IWTSVirtualChannelCallback, IWTSVirtualChannelManager,
1313
};
@@ -50,7 +50,7 @@ pub(crate) fn run_com_worker(
5050
command_rx: std_mpsc::Receiver<ComCommand>,
5151
on_write_dvc_rx: std_mpsc::Receiver<OnWriteDvc>,
5252
) {
53-
info!("COM worker thread started");
53+
debug!("COM worker thread started");
5454

5555
let mut active_channels: HashMap<u32, ActiveChannel> = HashMap::new();
5656

@@ -129,7 +129,7 @@ pub(crate) fn run_com_worker(
129129
match result {
130130
Ok(()) if accept.as_bool() => {
131131
if let Some(callback) = channel_callback {
132-
info!(channel_name = %channel_name, channel_id, "Plugin accepted DVC channel");
132+
debug!(channel_name = %channel_name, channel_id, "Plugin accepted DVC channel");
133133
active_channels.insert(
134134
channel_id,
135135
ActiveChannel {
@@ -187,7 +187,7 @@ pub(crate) fn run_com_worker(
187187
}
188188

189189
ComCommand::Shutdown => {
190-
info!("Shutting down COM plugin");
190+
debug!("Shutting down COM plugin");
191191

192192
// Close all active channels
193193
for (channel_id, active) in active_channels.drain() {
@@ -216,5 +216,5 @@ pub(crate) fn run_com_worker(
216216
}
217217
}
218218

219-
info!("COM worker thread exiting");
219+
debug!("COM worker thread exiting");
220220
}

crates/ironrdp-dvc-pipe-proxy/src/platform/unix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use async_trait::async_trait;
22
use tokio::fs;
33
use tokio::io::{AsyncReadExt as _, AsyncWriteExt as _};
4-
use tracing::{info, trace};
4+
use tracing::{debug, trace};
55

66
use crate::error::DvcPipeProxyError;
77
use crate::os_pipe::OsPipe;
@@ -19,7 +19,7 @@ impl OsPipe for UnixPipe {
1919
Ok(metadata) => {
2020
use std::os::unix::fs::FileTypeExt as _;
2121

22-
info!(
22+
debug!(
2323
%pipe_name,
2424
"DVC pipe already exists, removing stale file."
2525
);

crates/ironrdp-dvc-pipe-proxy/src/proxy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use ironrdp_core::impl_as_any;
44
use ironrdp_dvc::{DvcClientProcessor, DvcMessage, DvcProcessor};
55
use ironrdp_pdu::{PduResult, pdu_other_err};
66
use ironrdp_svc::SvcMessage;
7-
use tracing::{debug, info};
7+
use tracing::debug;
88

99
use crate::worker::{OnWriteDvcMessage, WorkerCtx, run_worker};
1010

@@ -49,7 +49,7 @@ impl DvcProcessor for DvcNamedPipeProxy {
4949
}
5050

5151
fn start(&mut self, channel_id: u32) -> PduResult<Vec<DvcMessage>> {
52-
info!(%self.channel_name, %self.named_pipe_name, "Starting DVC named pipe proxy");
52+
debug!(%self.channel_name, %self.named_pipe_name, "Starting DVC named pipe proxy");
5353

5454
let on_write_dvc = self
5555
.dvc_write_callback

0 commit comments

Comments
 (0)