Skip to content

Commit 79c7ffb

Browse files
committed
make tracing utility available for tests
1 parent 6dd2866 commit 79c7ffb

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

crates/chat-cli/src/cli/acp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use crate::os::Os;
4545
mod server;
4646
mod server_session;
4747
mod server_connection;
48-
mod util;
48+
pub(crate) mod util;
4949
#[cfg(test)]
5050
mod client_connection;
5151
#[cfg(test)]

crates/chat-cli/src/cli/acp/util.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,3 @@
44
pub fn ignore_error<E>(result: Result<(), E>) {
55
let _ = result;
66
}
7-
8-
/// Enables tracing to stderr. Useful when debugging a particular test.
9-
#[cfg(test)]
10-
#[allow(dead_code)]
11-
pub fn enable_tracing() {
12-
tracing_subscriber::fmt()
13-
.with_max_level(tracing::Level::DEBUG)
14-
.with_writer(std::io::stderr)
15-
.try_init()
16-
.ok();
17-
}

crates/chat-cli/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ pub mod telemetry;
1717
pub mod util;
1818

1919
pub use mcp_client::*;
20+
21+
mod test_util;

crates/chat-cli/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mod os;
1111
mod request;
1212
mod telemetry;
1313
mod util;
14+
mod test_util;
1415

1516
use std::process::ExitCode;
1617

crates/chat-cli/src/test_util.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![cfg(test)]
2+
3+
/// Enables tracing to stderr. Useful when debugging a particular test.
4+
#[allow(dead_code)]
5+
pub fn enable_tracing() {
6+
tracing_subscriber::fmt()
7+
.with_max_level(tracing::Level::DEBUG)
8+
.with_ansi(false)
9+
.with_writer(std::io::stderr)
10+
.try_init()
11+
.ok();
12+
}

0 commit comments

Comments
 (0)