Skip to content

Commit bc8f743

Browse files
authored
feat: Log SSH commands (#175)
1 parent 11325c3 commit bc8f743

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/native_mux_impl/command.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ impl Command {
7373

7474
let cmd = NonZeroByteSlice::new(&self.cmd).ok_or(Error::InvalidCommand)?;
7575

76+
#[cfg(feature = "tracing")]
77+
tracing::debug!(cmd = String::from_utf8_lossy(cmd.into_inner()).as_ref());
78+
7679
let session = Session::builder()
7780
.cmd(Cow::Borrowed(cmd))
7881
.subsystem(self.subsystem)

src/process_impl/command.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ impl Command {
5050
),
5151
Error,
5252
> {
53+
#[cfg(feature = "tracing")]
54+
tracing::debug!(cmd = ?self.builder.as_std());
55+
5356
let mut channel = self.builder.spawn().map_err(Error::Ssh)?;
5457

5558
let child_stdin = channel.stdin.take();

0 commit comments

Comments
 (0)