Skip to content

Commit 0fb65ef

Browse files
committed
tests/util/chaosproxy: Use tracing for logging
1 parent 7c69bec commit 0fb65ef

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/tests/util/chaosproxy.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use tokio::{
1010
runtime::Runtime,
1111
sync::broadcast::Sender,
1212
};
13+
use tracing::error;
1314
use url::Url;
1415

1516
pub(crate) struct ChaosProxy {
@@ -42,8 +43,8 @@ impl ChaosProxy {
4243

4344
let instance_clone = instance.clone();
4445
instance.runtime.spawn(async move {
45-
if let Err(err) = instance_clone.server_loop(listener).await {
46-
eprintln!("ChaosProxy server error: {err}");
46+
if let Err(error) = instance_clone.server_loop(listener).await {
47+
error!(%error, "ChaosProxy server error");
4748
}
4849
});
4950

@@ -119,15 +120,17 @@ impl ChaosProxy {
119120

120121
let break_networking_send = self.break_networking_send.clone();
121122
tokio::spawn(async move {
122-
if let Err(err) = proxy_data(break_networking_send, client_read, backend_write).await {
123-
eprintln!("ChaosProxy connection error: {err}");
123+
if let Err(error) = proxy_data(break_networking_send, client_read, backend_write).await
124+
{
125+
error!(%error, "ChaosProxy connection error");
124126
}
125127
});
126128

127129
let break_networking_send = self.break_networking_send.clone();
128130
tokio::spawn(async move {
129-
if let Err(err) = proxy_data(break_networking_send, backend_read, client_write).await {
130-
eprintln!("ChaosProxy connection error: {err}");
131+
if let Err(error) = proxy_data(break_networking_send, backend_read, client_write).await
132+
{
133+
error!(%error, "ChaosProxy connection error");
131134
}
132135
});
133136

0 commit comments

Comments
 (0)