Compare commits

...

1 Commits

Author SHA1 Message Date
durch 33e7d1bba9 Replace println with eprintln 2023-01-17 13:19:23 +01:00
5 changed files with 18 additions and 18 deletions
+5 -5
View File
@@ -104,10 +104,10 @@ impl From<Init> for OverrideConfig {
} }
pub async fn execute(args: Init, output: OutputFormat) -> Result<(), Box<dyn Error + Send + Sync>> { pub async fn execute(args: Init, output: OutputFormat) -> Result<(), Box<dyn Error + Send + Sync>> {
println!("Initialising gateway {}...", args.id); eprintln!("Initialising gateway {}...", args.id);
let already_init = if Config::default_config_file_path(Some(&args.id)).exists() { let already_init = if Config::default_config_file_path(Some(&args.id)).exists() {
println!( eprintln!(
"Gateway \"{}\" was already initialised before! Config information will be \ "Gateway \"{}\" was already initialised before! Config information will be \
overwritten (but keys will be kept)!", overwritten (but keys will be kept)!",
args.id args.id
@@ -147,15 +147,15 @@ pub async fn execute(args: Init, output: OutputFormat) -> Result<(), Box<dyn Err
) )
.expect("Failed to save identity keys"); .expect("Failed to save identity keys");
println!("Saved identity and mixnet sphinx keypairs"); eprintln!("Saved identity and mixnet sphinx keypairs");
} }
let config_save_location = config.get_config_file_save_location(); let config_save_location = config.get_config_file_save_location();
config config
.save_to_file(None) .save_to_file(None)
.expect("Failed to save the config file"); .expect("Failed to save the config file");
println!("Saved configuration file to {:?}", config_save_location); eprintln!("Saved configuration file to {:?}", config_save_location);
println!("Gateway configuration completed.\n\n\n"); eprintln!("Gateway configuration completed.\n\n\n");
Ok(crate::node::create_gateway(config) Ok(crate::node::create_gateway(config)
.await .await
+5 -5
View File
@@ -102,14 +102,14 @@ impl From<Run> for OverrideConfig {
} }
fn show_binding_warning(address: String) { fn show_binding_warning(address: String) {
println!("\n##### NOTE #####"); eprintln!("\n##### NOTE #####");
println!( eprintln!(
"\nYou are trying to bind to {} - you might not be accessible to other nodes\n\ "\nYou are trying to bind to {} - you might not be accessible to other nodes\n\
You can ignore this warning if you're running setup on a local network \n\ You can ignore this warning if you're running setup on a local network \n\
or have set a custom 'announce-host'", or have set a custom 'announce-host'",
address address
); );
println!("\n\n"); eprintln!("\n\n");
} }
fn special_addresses() -> Vec<&'static str> { fn special_addresses() -> Vec<&'static str> {
@@ -118,7 +118,7 @@ fn special_addresses() -> Vec<&'static str> {
pub async fn execute(args: Run, output: OutputFormat) -> Result<(), Box<dyn Error + Send + Sync>> { pub async fn execute(args: Run, output: OutputFormat) -> Result<(), Box<dyn Error + Send + Sync>> {
let id = args.id.clone(); let id = args.id.clone();
println!("Starting gateway {id}..."); eprintln!("Starting gateway {id}...");
let config = build_config(id, args)?; let config = build_config(id, args)?;
ensure_config_version_compatibility(&config)?; ensure_config_version_compatibility(&config)?;
@@ -128,7 +128,7 @@ pub async fn execute(args: Run, output: OutputFormat) -> Result<(), Box<dyn Erro
} }
let mut gateway = crate::node::create_gateway(config).await; let mut gateway = crate::node::create_gateway(config).await;
println!( eprintln!(
"\nTo bond your gateway you will need to install the Nym wallet, go to https://nymtech.net/get-involved and select the Download button.\n\ "\nTo bond your gateway you will need to install the Nym wallet, go to https://nymtech.net/get-involved and select the Download button.\n\
Select the correct version and install it to your machine. You will need to provide the following: \n "); Select the correct version and install it to your machine. You will need to provide the following: \n ");
gateway.print_node_details(output)?; gateway.print_node_details(output)?;
+3 -3
View File
@@ -69,19 +69,19 @@ fn print_signed_address(
ensure_correct_bech32_prefix(&wallet_address)?; ensure_correct_bech32_prefix(&wallet_address)?;
let signature = private_key.sign_text(wallet_address.as_ref()); let signature = private_key.sign_text(wallet_address.as_ref());
println!("The base58-encoded signature on '{wallet_address}' is: {signature}"); eprintln!("The base58-encoded signature on '{wallet_address}' is: {signature}");
Ok(()) Ok(())
} }
fn print_signed_text(private_key: &identity::PrivateKey, text: &str) { fn print_signed_text(private_key: &identity::PrivateKey, text: &str) {
println!( eprintln!(
"Signing the text {:?} using your mixnode's Ed25519 identity key...", "Signing the text {:?} using your mixnode's Ed25519 identity key...",
text text
); );
let signature = private_key.sign_text(text); let signature = private_key.sign_text(text);
println!( eprintln!(
"The base58-encoded signature on '{}' is: {}", "The base58-encoded signature on '{}' is: {}",
text, signature text, signature
); );
+3 -3
View File
@@ -22,7 +22,7 @@ fn fail_upgrade<D1: Display, D2: Display>(from_version: D1, to_version: D2) -> !
} }
fn print_start_upgrade<D1: Display, D2: Display>(from: D1, to: D2) { fn print_start_upgrade<D1: Display, D2: Display>(from: D1, to: D2) {
println!( eprintln!(
"\n==================\nTrying to upgrade gateway from {} to {} ...", "\n==================\nTrying to upgrade gateway from {} to {} ...",
from, to from, to
); );
@@ -36,7 +36,7 @@ fn print_failed_upgrade<D1: Display, D2: Display>(from: D1, to: D2) {
} }
fn print_successful_upgrade<D1: Display, D2: Display>(from: D1, to: D2) { fn print_successful_upgrade<D1: Display, D2: Display>(from: D1, to: D2) {
println!( eprintln!(
"Upgrade from {} to {} was successful!\n==================\n", "Upgrade from {} to {} was successful!\n==================\n",
from, to from, to
); );
@@ -121,7 +121,7 @@ fn do_upgrade(mut config: Config, args: &Upgrade, package_version: Version) {
let config_version = parse_config_version(&config); let config_version = parse_config_version(&config);
if config_version == package_version { if config_version == package_version {
println!("You're using the most recent version!"); eprintln!("You're using the most recent version!");
return; return;
} }
+2 -2
View File
@@ -122,8 +122,8 @@ where
let identity_keypair = load_identity_keys(&pathfinder); let identity_keypair = load_identity_keys(&pathfinder);
let Some(address) = self.config.get_wallet_address() else { let Some(address) = self.config.get_wallet_address() else {
let error_message = "Error: gateway hasn't set its wallet address".red(); let error_message = "Error: gateway hasn't set its wallet address".red();
println!("{error_message}"); eprintln!("{error_message}");
println!("Exiting..."); eprintln!("Exiting...");
process::exit(1); process::exit(1);
}; };
// perform extra validation to ensure we have correct prefix // perform extra validation to ensure we have correct prefix