fix println with eprintln for error

This commit is contained in:
Noor 2025-04-03 13:22:41 +05:30 committed by ghe0
parent f5cb2e0925
commit 07de221c62
Signed by: ghe0
GPG Key ID: 451028EE56A0FBB4
3 changed files with 6 additions and 7 deletions

@ -28,7 +28,7 @@ pub fn handle_app(app_matche: &ArgMatches) {
Some(("delete", subcom_args)) => cli_print(handle_delete(subcom_args)), Some(("delete", subcom_args)) => cli_print(handle_delete(subcom_args)),
Some(("list", subcom_args)) => cli_print(handle_list(subcom_args)), Some(("list", subcom_args)) => cli_print(handle_list(subcom_args)),
Some(("config", subcom_args)) => handle_config(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!() 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(("update", subcom_args)) => cli_print(handle_config_sub_update(subcom_args)),
Some(("get", subcom_args)) => cli_print(handle_config_sub_get(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.");
} }
} }
} }

@ -109,7 +109,7 @@ pub async fn list_contracts(req: ListAppContractsReq) -> Result<Vec<AppContract>
app_contracts.push(contract); app_contracts.push(contract);
} }
Err(e) => { Err(e) => {
println!("Brain disconnected from register_node: {e}"); eprintln!("Brain disconnected from register_node: {e}");
} }
} }
} }

@ -74,8 +74,7 @@ pub fn calculate_nanolp_for_app(
let total_units = let total_units =
(vcpus as f64 * 5f64) + (memory_mb as f64 / 200f64) + (disk_size_mb as f64 / 10000f64); (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; let locked_nano = (hours as f64 * 60f64 * total_units * node_price as f64) as u64;
// TODO: change all println to eprintln eprintln!(
println!(
"Node price: {}/unit/minute. Total Units for hardware requested: {:.4}. Locking {} LP (offering the App for {} hours).", "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, node_price as f64 / 1_000_000_000.0,
total_units, total_units,
@ -127,7 +126,7 @@ pub async fn deploy_new_app_and_update_config(
if new_app_res.error.is_empty() { if new_app_res.error.is_empty() {
if let Some(launch_config) = launch_config { if let Some(launch_config) = launch_config {
println!("Deploying..."); eprintln!("Deploying...");
tokio::time::sleep(tokio::time::Duration::from_millis(2500)).await; tokio::time::sleep(tokio::time::Duration::from_millis(2500)).await;
Retry::spawn(FixedInterval::from_millis(1000).take(10), || { Retry::spawn(FixedInterval::from_millis(1000).take(10), || {
log::debug!("retrying attestation and launch config update"); log::debug!("retrying attestation and launch config update");