aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-08-27 16:13:29 +0200
committerAlex Auvolat <alex@adnab.me>2023-08-27 16:13:29 +0200
commit30ce3a97c976048daa659409ec36798ddc07b194 (patch)
tree88219a9bc479fccc1e8f8cda73932244ecb6f0f4 /src/main.rs
parenta3602eac8294fb847912fc084e8943587da7ef56 (diff)
downloadtricot-30ce3a97c976048daa659409ec36798ddc07b194.tar.gz
tricot-30ce3a97c976048daa659409ec36798ddc07b194.zip
replace log,pretty_env_logger by tracing,tracing_subscriber and add timedocker-50
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 9 insertions, 3 deletions
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() {