Replace println with eprintln!

This commit is contained in:
durch
2023-01-17 13:39:49 +01:00
parent ea68d42886
commit ea35a37d4c
6 changed files with 22 additions and 22 deletions
+5 -5
View File
@@ -103,10 +103,10 @@ impl From<Init> for OverrideConfig {
}
pub async fn execute(args: &Init, output: OutputFormat) {
println!("Initialising gateway {}...", args.id);
eprintln!("Initialising gateway {}...", args.id);
let already_init = if Config::default_config_file_path(Some(&args.id)).exists() {
println!(
eprintln!(
"Gateway \"{}\" was already initialised before! Config information will be \
overwritten (but keys will be kept)!",
args.id
@@ -146,15 +146,15 @@ pub async fn execute(args: &Init, output: OutputFormat) {
)
.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();
config
.save_to_file(None)
.expect("Failed to save the config file");
println!("Saved configuration file to {:?}", config_save_location);
println!("Gateway configuration completed.\n\n\n");
eprintln!("Saved configuration file to {:?}", config_save_location);
eprintln!("Gateway configuration completed.\n\n\n");
crate::node::create_gateway(config)
.await
+4 -4
View File
@@ -146,8 +146,8 @@ pub(crate) fn validate_bech32_address_or_exit(address: &str) {
bech32_address_validation::try_bech32_decode(address)
{
let error_message = format!("Error: wallet address decoding failed: {err}").red();
println!("{}", error_message);
println!("Exiting...");
eprintln!("{}", error_message);
eprintln!("Exiting...");
process::exit(1);
}
@@ -155,8 +155,8 @@ pub(crate) fn validate_bech32_address_or_exit(address: &str) {
bech32_address_validation::validate_bech32_prefix(&prefix, address)
{
let error_message = format!("Error: wallet address type is wrong, {err}").red();
println!("{}", error_message);
println!("Exiting...");
eprintln!("{}", error_message);
eprintln!("Exiting...");
process::exit(1);
}
}
+5 -5
View File
@@ -103,14 +103,14 @@ impl From<Run> for OverrideConfig {
}
fn show_binding_warning(address: String) {
println!("\n##### NOTE #####");
println!(
eprintln!("\n##### NOTE #####");
eprintln!(
"\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\
or have set a custom 'announce-host'",
address
);
println!("\n\n");
eprintln!("\n\n");
}
fn special_addresses() -> Vec<&'static str> {
@@ -118,7 +118,7 @@ fn special_addresses() -> Vec<&'static str> {
}
pub async fn execute(args: &Run, output: OutputFormat) {
println!("Starting gateway {}...", args.id);
eprintln!("Starting gateway {}...", args.id);
let mut config = match Config::load_from_file(Some(&args.id)) {
Ok(cfg) => cfg,
@@ -144,7 +144,7 @@ pub async fn execute(args: &Run, output: OutputFormat) {
}
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\
Select the correct version and install it to your machine. You will need to provide the following: \n ");
gateway.print_node_details(output);
+3 -3
View File
@@ -65,18 +65,18 @@ fn print_signed_address(private_key: &identity::PrivateKey, wallet_address: nyxd
validate_bech32_address_or_exit(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}",);
}
fn print_signed_text(private_key: &identity::PrivateKey, text: &str) {
println!(
eprintln!(
"Signing the text {:?} using your mixnode's Ed25519 identity key...",
text
);
let signature = private_key.sign_text(text);
println!(
eprintln!(
"The base58-encoded signature on '{}' is: {}",
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) {
println!(
eprintln!(
"\n==================\nTrying to upgrade gateway 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) {
println!(
eprintln!(
"Upgrade from {} to {} was successful!\n==================\n",
from, to
);
@@ -121,7 +121,7 @@ fn do_upgrade(mut config: Config, args: &Upgrade, package_version: Version) {
let config_version = parse_config_version(&config);
if config_version == package_version {
println!("You're using the most recent version!");
eprintln!("You're using the most recent version!");
return;
}
+2 -2
View File
@@ -119,8 +119,8 @@ where
let identity_keypair = load_identity_keys(&pathfinder);
let Some(address) = self.config.get_wallet_address() else {
let error_message = "Error: gateway hasn't set its wallet address".red();
println!("{error_message}");
println!("Exiting...");
eprintln!("{error_message}");
eprintln!("Exiting...");
process::exit(1);
};
// perform extra validation to ensure we have correct prefix