Skip to content

Commit

Permalink
chore: handle more sources of excess cosmic-config logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Feb 19, 2025
1 parent ab6de53 commit 76348bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl Default for Core {
system_theme_mode: ThemeMode::config()
.map(|c| {
ThemeMode::get_entry(&c).unwrap_or_else(|(errors, mode)| {
for why in errors {
for why in errors.into_iter().filter(cosmic_config::Error::is_err) {
tracing::error!(?why, "ThemeMode config entry error");
}
mode
Expand Down
20 changes: 16 additions & 4 deletions src/app/cosmic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ where
.core()
.watch_config::<crate::config::CosmicTk>(crate::config::ID)
.map(|update| {
for why in update.errors {
for why in update
.errors
.into_iter()
.filter(cosmic_config::Error::is_err)
{
tracing::error!(?why, "cosmic toolkit config update error");
}

Expand All @@ -216,7 +220,11 @@ where
},
)
.map(|update| {
for why in update.errors {
for why in update
.errors
.into_iter()
.filter(cosmic_config::Error::is_err)
{
tracing::error!(?why, "cosmic theme config update error");
}
Message::SystemThemeChange(
Expand All @@ -229,8 +237,12 @@ where
.core()
.watch_config::<ThemeMode>(cosmic_theme::THEME_MODE_ID)
.map(|update| {
for e in update.errors {
tracing::error!("{e}");
for error in update
.errors
.into_iter()
.filter(cosmic_config::Error::is_err)
{
tracing::error!(?error, "error reading system theme mode update");
}
Message::SystemThemeModeChange(update.keys, update.config)
})
Expand Down
2 changes: 1 addition & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub static COSMIC_TK: LazyLock<RwLock<CosmicTk>> = LazyLock::new(|| {
CosmicTk::config()
.map(|c| {
CosmicTk::get_entry(&c).unwrap_or_else(|(errors, mode)| {
for why in errors {
for why in errors.into_iter().filter(cosmic_config::Error::is_err) {
tracing::error!(?why, "CosmicTk config entry error");
}
mode
Expand Down

0 comments on commit 76348bb

Please sign in to comment.