fix: refactor log usage
Some checks are pending
Conventional Commits / Conventional Commits (push) Waiting to run

Fixes: #10
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
Christina Sørensen 2024-09-05 07:53:05 +02:00
parent c6fd77bc01
commit 11e92f0e6b
Signed by: cafkafk
GPG key ID: 26C542FD97F965CE

View file

@ -11,8 +11,7 @@ use futures::future::join_all;
use gethostname::gethostname; use gethostname::gethostname;
use itertools::Itertools; use itertools::Itertools;
#[allow(unused)] use log;
use log::{debug, error, info, trace, warn};
use crate::nix::get_requisites; use crate::nix::get_requisites;
@ -47,7 +46,7 @@ async fn main() -> io::Result<()> {
3 => env::set_var("RUST_LOG", "debug"), 3 => env::set_var("RUST_LOG", "debug"),
4 => env::set_var("RUST_LOG", "trace"), 4 => env::set_var("RUST_LOG", "trace"),
_ => { _ => {
trace!("More than four -v flags don't increase log level."); log::trace!("More than four -v flags don't increase log level.");
env::set_var("RUST_LOG", "trace") env::set_var("RUST_LOG", "trace")
} }
} }
@ -83,7 +82,7 @@ async fn main() -> io::Result<()> {
let domain = cache_url.to_owned(); let domain = cache_url.to_owned();
let ips: Vec<std::net::IpAddr> = lookup_host(&domain).unwrap(); let ips: Vec<std::net::IpAddr> = lookup_host(&domain).unwrap();
debug!("{:#?}", &ips); log::debug!("{:#?}", &ips);
let domain_addr = SocketAddr::new(ips[0], 443); let domain_addr = SocketAddr::new(ips[0], 443);
@ -116,7 +115,7 @@ async fn main() -> io::Result<()> {
let client = client.clone(); let client = client.clone();
let domain = domain.clone(); let domain = domain.clone();
tokio::spawn(async move { tokio::spawn(async move {
info!("connecting to {domain} {domain_addr:#?} for {hash}"); log::info!("connecting to {domain} {domain_addr:#?} for {hash}");
net::nar_exists(client, &domain, &hash, SLIDE).await net::nar_exists(client, &domain, &hash, SLIDE).await
}) })
}) })