From 9286fa8f5cd6ddfedf2dde703829da5b1064cac1 Mon Sep 17 00:00:00 2001 From: Quentin Richert Date: Wed, 8 Jan 2025 19:27:55 +0100 Subject: [PATCH] feat: Log SSH commands --- src/native_mux_impl/command.rs | 3 +++ src/process_impl/command.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/native_mux_impl/command.rs b/src/native_mux_impl/command.rs index 96dcbd90e..2122ea7e2 100644 --- a/src/native_mux_impl/command.rs +++ b/src/native_mux_impl/command.rs @@ -73,6 +73,9 @@ impl Command { let cmd = NonZeroByteSlice::new(&self.cmd).ok_or(Error::InvalidCommand)?; + #[cfg(feature = "tracing")] + tracing::debug!(cmd = String::from_utf8_lossy(cmd.into_inner()).as_ref()); + let session = Session::builder() .cmd(Cow::Borrowed(cmd)) .subsystem(self.subsystem) diff --git a/src/process_impl/command.rs b/src/process_impl/command.rs index 56b41076b..fb1e42914 100644 --- a/src/process_impl/command.rs +++ b/src/process_impl/command.rs @@ -50,6 +50,9 @@ impl Command { ), Error, > { + #[cfg(feature = "tracing")] + tracing::debug!(cmd = ?self.builder.as_std()); + let mut channel = self.builder.spawn().map_err(Error::Ssh)?; let child_stdin = channel.stdin.take();