diff --git a/Cargo.toml b/Cargo.toml index e37badb..f458e55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ serde = { version = "1.0", features = ["serde_derive"] } serde_json = "1.0" tokio = { version = "1", features = ["full"] } axum = { version = "0.6.18", features = ["headers", "http1", "json", "tokio", "query"] } -log = { version = "0.4", optional = true } +log = "0.4" env_logger = { version = "0.11.8", optional = true } chrono = { version = "0.4", optional = true } clap = { version = "4.5.53", features = ["color", "derive", "help", "usage", "std", "env"] } @@ -24,6 +24,6 @@ tower = "0.4" [features] default = ["logging"] -logging = ["dep:log", "dep:env_logger"] +logging = ["dep:env_logger"] json-logging = ["dep:chrono", "logging"] redis = [] diff --git a/src/main.rs b/src/main.rs index 7f58996..d9ea950 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,6 @@ async fn main() { init_logs(&cfg); if cfg.api_key().is_none() { - #[cfg(feature = "logging")] log::warn!("No API key is configured, authentication is disabled"); } @@ -36,7 +35,6 @@ async fn main() { .with_state(state); let addr: SocketAddr = cfg.address().unwrap(); - #[cfg(feature = "logging")] log::info!("Running flagpole on {:?}", addr); axum::Server::bind(&addr) @@ -45,7 +43,6 @@ async fn main() { .await .unwrap(); - #[cfg(feature = "logging")] log::info!("Server shutdown complete"); } @@ -94,11 +91,9 @@ async fn shutdown_signal() { tokio::select! { _ = ctrl_c => { - #[cfg(feature = "logging")] log::info!("Received SIGINT (CTRL+C), initiating graceful shutdown"); }, _ = terminate => { - #[cfg(feature = "logging")] log::info!("Received SIGTERM, initiating graceful shutdown"); }, } @@ -148,7 +143,6 @@ async fn put_flag( } let updated: bool = state.0.db.write().unwrap().set_value(&namespace, flag.clone()).unwrap(); if updated { - #[cfg(feature = "logging")] log::info!("Flag '{flag}' enabled in namespace <<{namespace}>>"); } StatusCode::NO_CONTENT @@ -164,7 +158,6 @@ async fn delete_flag( } let updated: bool = state.0.db.write().unwrap().delete_flag(&namespace, flag.clone()).unwrap(); if updated { - #[cfg(feature = "logging")] log::info!("Flag {flag} disabled in namespace {namespace}"); } StatusCode::NO_CONTENT