diff options
author | Alex Auvolat <alex@adnab.me> | 2023-08-27 16:13:29 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2023-08-27 16:13:29 +0200 |
commit | 30ce3a97c976048daa659409ec36798ddc07b194 (patch) | |
tree | 88219a9bc479fccc1e8f8cda73932244ecb6f0f4 /src | |
parent | a3602eac8294fb847912fc084e8943587da7ef56 (diff) | |
download | tricot-30ce3a97c976048daa659409ec36798ddc07b194.tar.gz tricot-30ce3a97c976048daa659409ec36798ddc07b194.zip |
replace log,pretty_env_logger by tracing,tracing_subscriber and add timedocker-50
Diffstat (limited to 'src')
-rw-r--r-- | src/cert_store.rs | 2 | ||||
-rw-r--r-- | src/http.rs | 2 | ||||
-rw-r--r-- | src/https.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 12 | ||||
-rw-r--r-- | src/metrics.rs | 2 | ||||
-rw-r--r-- | src/proxy_config.rs | 2 | ||||
-rw-r--r-- | src/reverse_proxy.rs | 2 |
7 files changed, 15 insertions, 9 deletions
diff --git a/src/cert_store.rs b/src/cert_store.rs index 2d1b772..a8072a2 100644 --- a/src/cert_store.rs +++ b/src/cert_store.rs @@ -5,10 +5,10 @@ use std::time::{Duration, Instant}; use anyhow::Result; use chrono::Utc; use futures::{FutureExt, TryFutureExt}; -use log::*; use tokio::select; use tokio::sync::{mpsc, watch}; use tokio::task::block_in_place; +use tracing::*; use acme_micro::create_p384_key; use acme_micro::{Directory, DirectoryUrl}; diff --git a/src/http.rs b/src/http.rs index 973e77f..9d85608 100644 --- a/src/http.rs +++ b/src/http.rs @@ -2,7 +2,7 @@ use std::net::SocketAddr; use std::sync::Arc; use anyhow::Result; -use log::*; +use tracing::*; use futures::future::Future; use http::uri::Authority; diff --git a/src/https.rs b/src/https.rs index 2353c2d..f31caef 100644 --- a/src/https.rs +++ b/src/https.rs @@ -4,7 +4,7 @@ use std::sync::{atomic::Ordering, Arc}; use std::time::{Duration, Instant}; use anyhow::Result; -use log::*; +use tracing::*; use accept_encoding_fork::Encoding; use async_compression::tokio::bufread::*; diff --git a/src/main.rs b/src/main.rs index 80c5b1e..2e08495 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,10 @@ #[macro_use] extern crate anyhow; -use log::*; use std::collections::BTreeMap; use std::sync::Arc; use std::time::Instant; +use tracing::*; use futures::{FutureExt, TryFutureExt}; use std::net::SocketAddr; @@ -118,7 +118,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| { @@ -241,7 +244,10 @@ async fn dump_config_on_change( .push(ent); } - println!("---- PROXY CONFIGURATION ----"); + println!( + "---- PROXY CONFIGURATION at {} ----", + chrono::offset::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true) + ); for ((host, prefix), ents) in cfg_map.iter_mut() { println!("{}{}:", host, prefix.as_deref().unwrap_or_default()); for ent in ents.iter() { diff --git a/src/metrics.rs b/src/metrics.rs index fa2657c..ee5c60a 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use anyhow::Result; use futures::future::*; -use log::*; +use tracing::*; use hyper::{ header::CONTENT_TYPE, diff --git a/src/proxy_config.rs b/src/proxy_config.rs index 848c99c..43d3929 100644 --- a/src/proxy_config.rs +++ b/src/proxy_config.rs @@ -6,8 +6,8 @@ use std::time::Duration; use anyhow::Result; use opentelemetry::{metrics, KeyValue}; -use log::*; use tokio::{select, sync::watch}; +use tracing::*; use crate::consul; diff --git a/src/reverse_proxy.rs b/src/reverse_proxy.rs index 258862b..23131c9 100644 --- a/src/reverse_proxy.rs +++ b/src/reverse_proxy.rs @@ -8,7 +8,7 @@ use std::sync::Arc; use std::time::{Duration, SystemTime}; use anyhow::Result; -use log::*; +use tracing::*; use http::{header::HeaderName, StatusCode}; use hyper::header::{HeaderMap, HeaderValue}; |