mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 21:30:03 -04:00
Use tracing crate for logging (#1192)
* egui_web: use tracing crate * egui_glow: use tracing crate * Log at the debug level * egui_demo_app: enable tracing to log to stdout * Use tracing in egui-winit * Add opt-in tracing support to egui
This commit is contained in:
@@ -25,6 +25,7 @@ all-features = true
|
||||
|
||||
[dependencies]
|
||||
egui = { version = "0.16.0", path = "../egui", default-features = false, features = ["single_threaded"] }
|
||||
tracing = "0.1"
|
||||
|
||||
directories-next = { version = "2", optional = true }
|
||||
ron = { version = "0.7", optional = true }
|
||||
|
||||
@@ -29,16 +29,17 @@ impl FileStorage {
|
||||
if let Some(proj_dirs) = directories_next::ProjectDirs::from("", "", app_name) {
|
||||
let data_dir = proj_dirs.data_dir().to_path_buf();
|
||||
if let Err(err) = std::fs::create_dir_all(&data_dir) {
|
||||
eprintln!(
|
||||
tracing::warn!(
|
||||
"Saving disabled: Failed to create app path at {:?}: {}",
|
||||
data_dir, err
|
||||
data_dir,
|
||||
err
|
||||
);
|
||||
None
|
||||
} else {
|
||||
Some(Self::from_ron_filepath(data_dir.join("app.ron")))
|
||||
}
|
||||
} else {
|
||||
eprintln!("Saving disabled: Failed to find path to data_dir.");
|
||||
tracing::warn!("Saving disabled: Failed to find path to data_dir.");
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -79,7 +80,7 @@ where
|
||||
match ron::de::from_reader(reader) {
|
||||
Ok(value) => Some(value),
|
||||
Err(err) => {
|
||||
eprintln!("ERROR: Failed to parse RON: {}", err);
|
||||
tracing::warn!("Failed to parse RON: {}", err);
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user