From 07de221c62dc0496cbae2803796cc3a12312101f Mon Sep 17 00:00:00 2001 From: Noor Date: Thu, 3 Apr 2025 13:22:41 +0530 Subject: [PATCH] fix println with eprintln for error --- src/sgx/cli_handler.rs | 6 +++--- src/sgx/grpc_brain.rs | 2 +- src/sgx/utils.rs | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/sgx/cli_handler.rs b/src/sgx/cli_handler.rs index e8ac91a..d23bbfc 100644 --- a/src/sgx/cli_handler.rs +++ b/src/sgx/cli_handler.rs @@ -28,7 +28,7 @@ pub fn handle_app(app_matche: &ArgMatches) { Some(("delete", subcom_args)) => cli_print(handle_delete(subcom_args)), Some(("list", subcom_args)) => cli_print(handle_list(subcom_args)), Some(("config", subcom_args)) => handle_config(subcom_args), - _ => println!("No valid subcommand provided. Use --help for more information."), + _ => eprintln!("No valid subcommand provided. Use --help for more information."), } } @@ -46,7 +46,7 @@ pub fn handle_app_nodes(matches: &ArgMatches) { todo!() } _ => { - println!("Available commands are search, inspec and report. Use --help for more information.") + eprintln!("Available commands are search, inspec and report. Use --help for more information.") } } } @@ -202,7 +202,7 @@ fn handle_config(matches: &ArgMatches) { Some(("update", subcom_args)) => cli_print(handle_config_sub_update(subcom_args)), Some(("get", subcom_args)) => cli_print(handle_config_sub_get(subcom_args)), _ => { - println!("No valid config subcommand provided."); + eprintln!("No valid config subcommand provided."); } } } diff --git a/src/sgx/grpc_brain.rs b/src/sgx/grpc_brain.rs index dd92e18..c2b4678 100644 --- a/src/sgx/grpc_brain.rs +++ b/src/sgx/grpc_brain.rs @@ -109,7 +109,7 @@ pub async fn list_contracts(req: ListAppContractsReq) -> Result app_contracts.push(contract); } Err(e) => { - println!("Brain disconnected from register_node: {e}"); + eprintln!("Brain disconnected from register_node: {e}"); } } } diff --git a/src/sgx/utils.rs b/src/sgx/utils.rs index 7444d65..422c3ee 100644 --- a/src/sgx/utils.rs +++ b/src/sgx/utils.rs @@ -74,8 +74,7 @@ pub fn calculate_nanolp_for_app( let total_units = (vcpus as f64 * 5f64) + (memory_mb as f64 / 200f64) + (disk_size_mb as f64 / 10000f64); let locked_nano = (hours as f64 * 60f64 * total_units * node_price as f64) as u64; - // TODO: change all println to eprintln - println!( + eprintln!( "Node price: {}/unit/minute. Total Units for hardware requested: {:.4}. Locking {} LP (offering the App for {} hours).", node_price as f64 / 1_000_000_000.0, total_units, @@ -127,7 +126,7 @@ pub async fn deploy_new_app_and_update_config( if new_app_res.error.is_empty() { if let Some(launch_config) = launch_config { - println!("Deploying..."); + eprintln!("Deploying..."); tokio::time::sleep(tokio::time::Duration::from_millis(2500)).await; Retry::spawn(FixedInterval::from_millis(1000).take(10), || { log::debug!("retrying attestation and launch config update");