ptmgr: Use PluggableTransport::identity in logs.

This lets us avoid logging the user's path.
This commit is contained in:
Nick Mathewson 2022-11-29 19:20:44 -05:00
parent bb0749cd42
commit f6311c83f7
2 changed files with 10 additions and 2 deletions

View File

@ -606,6 +606,14 @@ impl PluggableTransport {
&self.cmethods
}
/// Return a loggable identifier for this transport.
pub(crate) fn identifier(&self) -> &str {
match &self.inner {
Some(child) => &child.identifier,
None => "<not yet launched>",
}
}
/// Get the next [`PtMessage`] from the running transport. It is recommended to call this
/// in a loop once a PT has been launched, in order to forward log messages and find out about
/// status updates.

View File

@ -203,10 +203,10 @@ impl<R: Runtime> PtReactor<R> {
match result {
Ok(m) => {
// FIXME(eta): We should forward the Status messages onto API consumers.
debug!("PT {} message: {:?}", self.running[idx].binary_path.to_string_lossy(), m);
debug!("PT {} message: {:?}", self.running[idx].identifier(), m);
},
Err(e) => {
warn!("PT {} quit: {:?}", self.running[idx].binary_path.to_string_lossy(), e);
warn!("PT {} quit: {:?}", self.running[idx].identifier(), e);
let pt = self.running.remove(idx);
self.remove_pt(pt);
}