fix(cosmic-config): Fixes for error printing
* Use `tracing::error!` in places where `eprintln!` was used * Loop over errors and print seperately * Print errors with `Display` rather than `Debug` * Don't print errors that should be ignored - Matches https://github.com/pop-os/libcosmic/pull/949, for same reasons. With this, and the previous change, cosmic-panel no longer spams a bunch of config errors from different applets on start.
This commit is contained in:
parent
2d62503fdf
commit
66a2632e2e
1 changed files with 12 additions and 4 deletions
|
|
@ -156,8 +156,16 @@ fn watcher_stream<T: CosmicConfigEntry + Send + Sync + Default + 'static + Clone
|
|||
let mut config = match T::get_entry(&cosmic_config) {
|
||||
Ok(config) => config,
|
||||
Err((errors, default)) => {
|
||||
if !errors.is_empty() {
|
||||
eprintln!("Error getting config: {config_id} {errors:?}");
|
||||
for why in &errors {
|
||||
if why.is_err() {
|
||||
if let crate::Error::GetKey(_, err) = &why {
|
||||
if err.kind() == std::io::ErrorKind::NotFound {
|
||||
// No system default config installed; don't error
|
||||
continue;
|
||||
}
|
||||
}
|
||||
tracing::error!("error getting config: {config_id} {why}");
|
||||
}
|
||||
}
|
||||
default
|
||||
}
|
||||
|
|
@ -171,7 +179,7 @@ fn watcher_stream<T: CosmicConfigEntry + Send + Sync + Default + 'static + Clone
|
|||
})
|
||||
.await
|
||||
{
|
||||
eprintln!("Failed to send config: {err}");
|
||||
tracing::error!("Failed to send config: {err}");
|
||||
}
|
||||
|
||||
loop {
|
||||
|
|
@ -211,7 +219,7 @@ fn watcher_stream<T: CosmicConfigEntry + Send + Sync + Default + 'static + Clone
|
|||
})
|
||||
.await
|
||||
{
|
||||
eprintln!("Failed to send config update: {err}");
|
||||
tracing::error!("Failed to send config update: {err}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue