diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dns_config.rs | 2 | ||||
-rw-r--r-- | src/dns_updater.rs | 7 | ||||
-rw-r--r-- | src/main.rs | 7 | ||||
-rw-r--r-- | src/provider/gandi.rs | 2 |
4 files changed, 13 insertions, 5 deletions
diff --git a/src/dns_config.rs b/src/dns_config.rs index 188c6fc..25cc5f0 100644 --- a/src/dns_config.rs +++ b/src/dns_config.rs @@ -8,8 +8,8 @@ use anyhow::Result; use futures::future::BoxFuture; use futures::stream::{FuturesUnordered, StreamExt}; -use log::*; use tokio::{select, sync::watch, time::sleep}; +use tracing::*; use df_consul::*; diff --git a/src/dns_updater.rs b/src/dns_updater.rs index 06ba408..d781671 100644 --- a/src/dns_updater.rs +++ b/src/dns_updater.rs @@ -1,10 +1,11 @@ use std::net::{Ipv4Addr, Ipv6Addr}; use std::sync::Arc; +use std::time::Duration; use anyhow::{anyhow, bail, Result}; -use log::*; use tokio::select; use tokio::sync::watch; +use tracing::*; use crate::dns_config::*; use crate::provider::DnsProvider; @@ -15,6 +16,10 @@ pub async fn dns_updater_task( allowed_domains: Vec<String>, mut must_exit: watch::Receiver<bool>, ) { + info!("DNS updater will start in 5 seconds"); + tokio::time::sleep(Duration::from_secs(5)).await; + info!("DNS updater starting"); + let mut config = Arc::new(DnsConfig::new()); while !*must_exit.borrow() { select!( diff --git a/src/main.rs b/src/main.rs index a55f271..667c058 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,9 @@ use std::sync::Arc; -use log::*; use structopt::StructOpt; use tokio::select; use tokio::sync::watch; +use tracing::*; mod dns_config; mod dns_updater; @@ -54,7 +54,10 @@ async fn main() { if std::env::var("RUST_LOG").is_err() { std::env::set_var("RUST_LOG", "tricot=info") } - pretty_env_logger::init(); + tracing_subscriber::fmt() + .with_writer(std::io::stderr) + .with_env_filter(tracing_subscriber::filter::EnvFilter::from_default_env()) + .init(); // Abort on panic (same behavior as in Go) std::panic::set_hook(Box::new(|panic_info| { diff --git a/src/provider/gandi.rs b/src/provider/gandi.rs index 1f4f51f..85bf570 100644 --- a/src/provider/gandi.rs +++ b/src/provider/gandi.rs @@ -2,9 +2,9 @@ use std::net::{Ipv4Addr, Ipv6Addr}; use anyhow::{anyhow, Result}; use async_trait::async_trait; -use log::{info, warn}; use reqwest::header; use serde::Serialize; +use tracing::{info, warn}; use crate::provider::DnsProvider; use crate::Opt; |