Add Error when logging errors

This commit is contained in:
Andrea Moro 2024-11-12 12:38:32 +01:00
parent 34dab49bf4
commit 5edac13e00

View file

@ -1,5 +1,5 @@
use colog; use colog;
use log::info; use log::{info, error};
use num_bigint::BigUint; use num_bigint::BigUint;
use num_primes::Generator; use num_primes::Generator;
use num_traits::cast::ToPrimitive; use num_traits::cast::ToPrimitive;
@ -78,7 +78,7 @@ fn main() {
0 => info!("No input provided"), 0 => info!("No input provided"),
_ => info!("{} bytes read", n), _ => info!("{} bytes read", n),
}, },
Err(error) => println!("error: {error}"), Err(error) => error!("error: {error}"),
} }
let mut rsa_size: String = "".to_string(); let mut rsa_size: String = "".to_string();
@ -89,7 +89,7 @@ fn main() {
0 => info!("No input provided"), 0 => info!("No input provided"),
_ => info!("{} bytes read", n), _ => info!("{} bytes read", n),
}, },
Err(error) => println!("error: {error}"), Err(error) => error!("error: {error}"),
} }
let rsa = RSA::new(rsa_size.trim().parse().unwrap()); let rsa = RSA::new(rsa_size.trim().parse().unwrap());