diff --git a/frontend/src/pages/settings.rs b/frontend/src/pages/settings.rs
index 86aa400..6395f2f 100644
--- a/frontend/src/pages/settings.rs
+++ b/frontend/src/pages/settings.rs
@@ -837,6 +837,27 @@ pub fn settings_page() -> Html {
+ // Logging
+
+
diff --git a/frontend/src/types.rs b/frontend/src/types.rs
index c76d232..55450b7 100644
--- a/frontend/src/types.rs
+++ b/frontend/src/types.rs
@@ -402,6 +402,12 @@ pub struct AppConfig {
pub scheduling: SchedulingConfigFe,
#[serde(default)]
pub musicbrainz: MusicBrainzConfigFe,
+ #[serde(default = "default_log_level")]
+ pub log_level: String,
+}
+
+fn default_log_level() -> String {
+ "info".into()
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
diff --git a/src/main.rs b/src/main.rs
index b6b615e..55fbff4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -35,18 +35,27 @@ struct Cli {
async fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
+ let mut config = AppConfig::load(cli.config.as_deref());
+
let filter = match cli.verbose {
- 0 => "info,shanty_web=info",
- 1 => "info,shanty_web=debug",
- _ => "debug,shanty_web=trace",
+ 0 => {
+ let level = config.log_level.to_lowercase();
+ match level.as_str() {
+ "error" => "error".to_string(),
+ "warn" => "warn".to_string(),
+ "debug" => "debug,shanty_web=debug".to_string(),
+ "trace" => "trace,shanty_web=trace".to_string(),
+ _ => "info,shanty_web=info".to_string(),
+ }
+ }
+ 1 => "info,shanty_web=debug".to_string(),
+ _ => "debug,shanty_web=trace".to_string(),
};
tracing_subscriber::fmt()
.with_env_filter(
- EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new(filter)),
+ EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new(&filter)),
)
.init();
-
- let mut config = AppConfig::load(cli.config.as_deref());
if let Some(port) = cli.port {
config.web.port = port;
}