mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -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:
@@ -28,8 +28,12 @@ epaint = { version = "0.16.0", path = "../epaint", default-features = false }
|
||||
|
||||
ahash = "0.7"
|
||||
nohash-hasher = "0.2"
|
||||
|
||||
# Optional:
|
||||
ron = { version = "0.7", optional = true }
|
||||
serde = { version = "1", features = ["derive", "rc"], optional = true }
|
||||
# egui doesn't log much, but when it does, it uses `tracing`
|
||||
tracing = { version = "0.1", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["default_fonts", "single_threaded"]
|
||||
@@ -37,6 +41,9 @@ default = ["default_fonts", "single_threaded"]
|
||||
# add compatibility with https://crates.io/crates/cint
|
||||
cint = ["epaint/cint"]
|
||||
|
||||
# implement bytemuck on most types.
|
||||
convert_bytemuck = ["epaint/convert_bytemuck"]
|
||||
|
||||
# If set, egui will use `include_bytes!` to bundle some fonts.
|
||||
# If you plan on specifying your own fonts you may disable this feature.
|
||||
default_fonts = ["epaint/default_fonts"]
|
||||
@@ -55,9 +62,6 @@ persistence = ["serde", "epaint/serialize", "ron"]
|
||||
# implement serde on most types.
|
||||
serialize = ["serde", "epaint/serialize"]
|
||||
|
||||
# implement bytemuck on most types.
|
||||
convert_bytemuck = ["epaint/convert_bytemuck"]
|
||||
|
||||
# multi_threaded is only needed if you plan to use the same egui::Context
|
||||
# from multiple threads. It comes with a minor performance impact.
|
||||
single_threaded = ["epaint/single_threaded"]
|
||||
|
||||
@@ -275,11 +275,12 @@ impl Element {
|
||||
fn from_ron_str<T: serde::de::DeserializeOwned>(ron: &str) -> Option<T> {
|
||||
match ron::from_str::<T>(ron) {
|
||||
Ok(value) => Some(value),
|
||||
Err(err) => {
|
||||
eprintln!(
|
||||
Err(_err) => {
|
||||
#[cfg(feature = "tracing")]
|
||||
tracing::warn!(
|
||||
"egui: Failed to deserialize {} from memory: {}, ron error: {:?}",
|
||||
std::any::type_name::<T>(),
|
||||
err,
|
||||
_err,
|
||||
ron
|
||||
);
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user