Skip to content

Commit

Permalink
Include path in Debug for FileSink.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Jul 25, 2023
1 parent 891414b commit fbf8f11
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/re_log_encoding/src/file_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ pub struct FileSink {
// None = quit
tx: Mutex<Sender<Option<LogMsg>>>,
join_handle: Option<std::thread::JoinHandle<()>>,

/// Only used for diagnostics, not for access after `new()`.
path: PathBuf,
}

impl Drop for FileSink {
Expand Down Expand Up @@ -72,6 +75,7 @@ impl FileSink {
Ok(Self {
tx: tx.into(),
join_handle: Some(join_handle),
path,
})
}

Expand All @@ -82,7 +86,8 @@ impl FileSink {

impl fmt::Debug for FileSink {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// It would be useful to print the path, but that information is not remembered.
f.debug_struct("FileSink").finish_non_exhaustive()
f.debug_struct("FileSink")
.field("path", &self.path)
.finish_non_exhaustive()
}
}

0 comments on commit fbf8f11

Please sign in to comment.