dtmm: Filter file dialog error log
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
Druid's implementation makes it so that cancelling the file dialog logs an error tracing event. Closes #133.
This commit is contained in:
parent
6f0fdc5086
commit
6ab514c428
1 changed files with 13 additions and 1 deletions
|
@ -56,7 +56,7 @@ impl std::io::Write for ChannelWriter {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_tracing_subscriber(tx: UnboundedSender<Vec<u8>>, level: Option<LogLevel>) {
|
pub fn create_tracing_subscriber(tx: UnboundedSender<Vec<u8>>, level: Option<LogLevel>) {
|
||||||
let env_layer = if let Some(level) = level {
|
let mut env_layer = if let Some(level) = level {
|
||||||
EnvFilter::from(level)
|
EnvFilter::from(level)
|
||||||
} else if cfg!(debug_assertions) {
|
} else if cfg!(debug_assertions) {
|
||||||
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"))
|
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"))
|
||||||
|
@ -64,6 +64,18 @@ pub fn create_tracing_subscriber(tx: UnboundedSender<Vec<u8>>, level: Option<Log
|
||||||
EnvFilter::new("error,dtmm=info")
|
EnvFilter::new("error,dtmm=info")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The internal implementation of Druid's GTK file dialog turns
|
||||||
|
// cancelling the dialog into an error. The, also internal, wrapper
|
||||||
|
// then logs and swallows the error.
|
||||||
|
// Therefore, as a consumer of the library, we don't have any way
|
||||||
|
// to customize this behavior, and instead have to filter out the
|
||||||
|
// tracing event.
|
||||||
|
env_layer = env_layer.add_directive(
|
||||||
|
"druid_shell::backend::gtk::window=off"
|
||||||
|
.parse()
|
||||||
|
.expect("Invalid env filter directive"),
|
||||||
|
);
|
||||||
|
|
||||||
let stdout_layer = fmt::layer().pretty();
|
let stdout_layer = fmt::layer().pretty();
|
||||||
|
|
||||||
let channel_layer = fmt::layer()
|
let channel_layer = fmt::layer()
|
||||||
|
|
Loading…
Add table
Reference in a new issue