1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00

Remove log feature (#7583)

This commit is contained in:
Emil Ernerfeldt
2025-10-02 20:09:48 +02:00
committed by GitHub
parent bd45406fad
commit 6579bb910b
16 changed files with 16 additions and 49 deletions

View File

@@ -48,9 +48,6 @@ color-hex = ["epaint/color-hex"]
## If you plan on specifying your own fonts you may disable this feature.
default_fonts = ["epaint/default_fonts"]
## Turn on the `log` feature, that makes egui log some errors using the [`log`](https://docs.rs/log) crate.
log = ["dep:log", "epaint/log"]
## [`mint`](https://docs.rs/mint) enables interoperability with other math libraries such as [`glam`](https://docs.rs/glam) and [`nalgebra`](https://docs.rs/nalgebra).
mint = ["epaint/mint"]
@@ -80,6 +77,7 @@ epaint = { workspace = true, default-features = false }
ahash.workspace = true
bitflags.workspace = true
log.workspace = true
nohash-hasher.workspace = true
profiling.workspace = true
smallvec.workspace = true
@@ -93,6 +91,5 @@ backtrace = { workspace = true, optional = true }
## Enable this when generating docs.
document-features = { workspace = true, optional = true }
log = { workspace = true, optional = true }
ron = { workspace = true, optional = true }
serde = { workspace = true, optional = true, features = ["derive", "rc"] }

View File

@@ -535,7 +535,7 @@ impl ContextImpl {
// New font definition loaded, so we need to reload all fonts.
self.fonts = None;
self.font_definitions = font_definitions;
#[cfg(feature = "log")]
log::trace!("Loading new font definitions");
}
@@ -559,7 +559,6 @@ impl ContextImpl {
.insert(font.name, Arc::new(font.data));
}
#[cfg(feature = "log")]
log::trace!("Adding new fonts");
}
@@ -568,7 +567,6 @@ impl ContextImpl {
let mut is_new = false;
let fonts = self.fonts.get_or_insert_with(|| {
#[cfg(feature = "log")]
log::trace!("Creating new Fonts");
is_new = true;
@@ -806,7 +804,6 @@ impl Context {
}
if max_passes <= output.platform_output.num_completed_passes {
#[cfg(feature = "log")]
log::debug!(
"Ignoring call request_discard, because max_passes={max_passes}. Requested from {:?}",
output.platform_output.request_discard_reasons
@@ -1819,7 +1816,6 @@ impl Context {
let cause = RepaintCause::new_reason(reason);
self.output_mut(|o| o.request_discard_reasons.push(cause));
#[cfg(feature = "log")]
log::trace!(
"request_discard: {}",
if self.will_discard() {
@@ -2525,7 +2521,6 @@ impl ContextImpl {
let parent = *self.viewport_parents.entry(id).or_default();
if !all_viewport_ids.contains(&parent) {
#[cfg(feature = "log")]
log::debug!(
"Removing viewport {:?} ({:?}): the parent is gone",
id,
@@ -2538,7 +2533,6 @@ impl ContextImpl {
let is_our_child = parent == ended_viewport_id && id != ViewportId::ROOT;
if is_our_child {
if !viewport.used {
#[cfg(feature = "log")]
log::debug!(
"Removing viewport {:?} ({:?}): it was never used this pass",
id,
@@ -2637,7 +2631,6 @@ impl Context {
let texture_atlas = if let Some(fonts) = ctx.fonts.as_ref() {
fonts.texture_atlas()
} else {
#[cfg(feature = "log")]
log::warn!("No font size matching {pixels_per_point} pixels per point found.");
ctx.fonts
.iter()

View File

@@ -154,7 +154,6 @@ impl PaintList {
#[inline(always)]
pub fn set(&mut self, idx: ShapeIdx, clip_rect: Rect, shape: Shape) {
if self.0.len() <= idx.0 {
#[cfg(feature = "log")]
log::warn!("Index {} is out of bounds for PaintList", idx.0);
return;
}

View File

@@ -19,7 +19,6 @@ impl DefaultBytesLoader {
.or_insert_with_key(|_uri| {
let bytes: Bytes = bytes.into();
#[cfg(feature = "log")]
log::trace!("loaded {} bytes for uri {_uri:?}", bytes.len());
bytes
@@ -53,14 +52,12 @@ impl BytesLoader for DefaultBytesLoader {
}
fn forget(&self, uri: &str) {
#[cfg(feature = "log")]
log::trace!("forget {uri:?}");
self.cache.lock().remove(uri);
}
fn forget_all(&self) {
#[cfg(feature = "log")]
log::trace!("forget all");
self.cache.lock().clear();

View File

@@ -102,14 +102,12 @@ impl TextureLoader for DefaultTextureLoader {
}
fn forget(&self, uri: &str) {
#[cfg(feature = "log")]
log::trace!("forget {uri:?}");
self.cache.lock().retain(|key, _value| key.uri != uri);
}
fn forget_all(&self) {
#[cfg(feature = "log")]
log::trace!("forget all");
self.cache.lock().clear();

View File

@@ -68,7 +68,6 @@ impl OperatingSystem {
{
Self::Nix
} else {
#[cfg(feature = "log")]
log::warn!(
"egui: Failed to guess operating system from User-Agent {:?}. Please file an issue at https://github.com/emilk/egui/issues",
user_agent

View File

@@ -1248,7 +1248,6 @@ impl Ui {
if let Some(tag) = tag {
tag.set_close();
} else {
#[cfg(feature = "log")]
log::warn!("Called ui.close() on a Ui that has no closable parent.");
}
}
@@ -1277,7 +1276,6 @@ impl Ui {
if let Some(tag) = tag {
tag.set_close();
} else {
#[cfg(feature = "log")]
log::warn!("Called ui.close_kind({ui_kind:?}) on ui with no such closable parent.");
}
}

View File

@@ -291,7 +291,6 @@ fn from_ron_str<T: serde::de::DeserializeOwned>(ron: &str) -> Option<T> {
match ron::from_str::<T>(ron) {
Ok(value) => Some(value),
Err(_err) => {
#[cfg(feature = "log")]
log::warn!(
"egui: Failed to deserialize {} from memory: {}, ron error: {:?}",
std::any::type_name::<T>(),