Skip to content

Commit

Permalink
Turn some warn logging to debug logging (#47)
Browse files Browse the repository at this point in the history
It is easy to mess the state up, but egui_tiles should recover. And it
is only interesting for developers debugging anyway, so it should not be
as loud as it was.
  • Loading branch information
emilk authored Feb 5, 2024
1 parent 35e7112 commit 7d93566
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ fn tree_ui(

// Temporarily remove the tile to circumvent the borrowchecker
let Some(mut tile) = tiles.remove(tile_id) else {
log::warn!("Missing tile {tile_id:?}");
log::debug!("Missing tile {tile_id:?}");
return;
};

Expand Down
12 changes: 6 additions & 6 deletions src/tiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl<Pane> Tiles<Pane> {
} = insertion_point;

let Some(mut parent_tile) = self.tiles.remove(&parent_id) else {
log::warn!("Failed to insert: could not find parent {parent_id:?}");
log::debug!("Failed to insert: could not find parent {parent_id:?}");
return;
};

Expand Down Expand Up @@ -333,7 +333,7 @@ impl<Pane> Tiles<Pane> {
// This should only happen if the user set up the tree in a bad state,
// or if it was restored from a bad state via serde.
// …or if there is a bug somewhere 😜
log::warn!(
log::debug!(
"GC collecting tiles: {:?}",
self.tiles
.keys()
Expand Down Expand Up @@ -384,7 +384,7 @@ impl<Pane> Tiles<Pane> {
tile_id: TileId,
) {
let Some(mut tile) = self.tiles.remove(&tile_id) else {
log::warn!("Failed to find tile {tile_id:?} during layout");
log::debug!("Failed to find tile {tile_id:?} during layout");
return;
};
self.rects.insert(tile_id, rect);
Expand All @@ -410,7 +410,7 @@ impl<Pane> Tiles<Pane> {
parent_kind: Option<ContainerKind>,
) -> SimplifyAction {
let Some(mut tile) = self.tiles.remove(&it) else {
log::warn!("Failed to find tile {it:?} during simplify");
log::debug!("Failed to find tile {it:?} during simplify");
return SimplifyAction::Remove;
};

Expand Down Expand Up @@ -498,7 +498,7 @@ impl<Pane> Tiles<Pane> {

pub(super) fn make_all_panes_children_of_tabs(&mut self, parent_is_tabs: bool, it: TileId) {
let Some(mut tile) = self.tiles.remove(&it) else {
log::warn!("Failed to find tile {it:?} during make_all_panes_children_of_tabs");
log::debug!("Failed to find tile {it:?} during make_all_panes_children_of_tabs");
return;
};

Expand Down Expand Up @@ -531,7 +531,7 @@ impl<Pane> Tiles<Pane> {
should_activate: &mut dyn FnMut(TileId, &Tile<Pane>) -> bool,
) -> bool {
let Some(mut tile) = self.tiles.remove(&it) else {
log::warn!("Failed to find tile {it:?} during make_active");
log::debug!("Failed to find tile {it:?} during make_active");
return false;
};

Expand Down
4 changes: 2 additions & 2 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ impl<Pane> Tree<Pane> {
// NOTE: important that we get the rect and tile in two steps,
// otherwise we could loose the tile when there is no rect.
let Some(rect) = self.tiles.try_rect(tile_id) else {
log::warn!("Failed to find rect for tile {tile_id:?} during ui");
log::debug!("Failed to find rect for tile {tile_id:?} during ui");
return;
};
let Some(mut tile) = self.tiles.remove(tile_id) else {
log::warn!("Failed to find tile {tile_id:?} during ui");
log::debug!("Failed to find tile {tile_id:?} during ui");
return;
};

Expand Down

0 comments on commit 7d93566

Please sign in to comment.