ws load test: use log crate instead of eprintln

This commit is contained in:
Joakim Frostegård 2022-11-12 15:30:16 +01:00
parent b122492713
commit 38a4856242
2 changed files with 6 additions and 6 deletions

View file

@ -29,7 +29,7 @@ impl Default for Config {
fn default() -> Self { fn default() -> Self {
Self { Self {
server_address: "127.0.0.1:3000".parse().unwrap(), server_address: "127.0.0.1:3000".parse().unwrap(),
log_level: LogLevel::Error, log_level: LogLevel::Warn,
num_workers: 1, num_workers: 1,
num_connections_per_worker: 16, num_connections_per_worker: 16,
connection_creation_interval_ms: 10, connection_creation_interval_ms: 10,

View file

@ -51,7 +51,7 @@ async fn periodically_open_connections(
if let Err(err) = if let Err(err) =
Connection::run(config, tls_config, load_test_state, num_active_connections).await Connection::run(config, tls_config, load_test_state, num_active_connections).await
{ {
eprintln!("connection creation error: {:?}", err); ::log::info!("connection creation error: {:#}", err);
} }
}) })
.detach(); .detach();
@ -105,7 +105,7 @@ impl Connection {
*num_active_connections.borrow_mut() += 1; *num_active_connections.borrow_mut() += 1;
if let Err(err) = connection.run_connection_loop().await { if let Err(err) = connection.run_connection_loop().await {
eprintln!("connection error: {}", err); ::log::info!("connection error: {:#}", err);
} }
*num_active_connections.borrow_mut() -= 1; *num_active_connections.borrow_mut() -= 1;
@ -169,7 +169,7 @@ impl Connection {
message message
} }
message => { message => {
eprintln!( ::log::warn!(
"Received WebSocket message of unexpected type: {:?}", "Received WebSocket message of unexpected type: {:?}",
message message
); );
@ -219,12 +219,12 @@ impl Connection {
.responses_error .responses_error
.fetch_add(1, Ordering::SeqCst); .fetch_add(1, Ordering::SeqCst);
eprintln!("received error response: {:?}", response.failure_reason); ::log::warn!("received error response: {:?}", response.failure_reason);
self.can_send = true; self.can_send = true;
} }
Err(err) => { Err(err) => {
eprintln!("error deserializing message: {:?}", err); ::log::error!("error deserializing message: {:#}", err);
} }
} }