Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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 = []
7 changes: 0 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand All @@ -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)
Expand All @@ -45,7 +43,6 @@ async fn main() {
.await
.unwrap();

#[cfg(feature = "logging")]
log::info!("Server shutdown complete");
}

Expand Down Expand Up @@ -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");
},
}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading