Added the log level

This commit is contained in:
Connor Johnstone
2026-03-22 13:05:09 -04:00
parent 3dba620c9b
commit 44c96d125a
3 changed files with 42 additions and 6 deletions

View File

@@ -837,6 +837,27 @@ pub fn settings_page() -> Html {
</div>
</div>
// Logging
<div class="card">
<h3>{ "Logging" }</h3>
<div class="form-group">
<label>{ "Log Level" }</label>
<select onchange={let config = config.clone(); Callback::from(move |e: Event| {
let select: HtmlSelectElement = e.target_unchecked_into();
let mut cfg = (*config).clone().unwrap();
cfg.log_level = select.value();
config.set(Some(cfg));
})}>
{ for [("error", "Error"), ("warn", "Warning"), ("info", "Info"), ("debug", "Debug"), ("trace", "Trace")].iter().map(|(v, label)| html! {
<option value={*v} selected={c.log_level == *v}>{ label }</option>
})}
</select>
<p class="text-muted text-sm" style="margin-top: 0.25rem;">
{ "Requires restart to take effect. CLI flags (-v, -vv) override this setting." }
</p>
</div>
</div>
<button type="submit" class="btn btn-primary">{ "Save Settings" }</button>
</form>
</div>

View File

@@ -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)]