tracing: Use don't log on hot paths without trace-level

This commit is contained in:
Victoria Brekenfeld 2023-03-03 19:34:41 +01:00
parent 9b416b5779
commit 3f462e3eb7
7 changed files with 20 additions and 20 deletions

View file

@ -37,7 +37,7 @@ ordered-float = "3.0"
glow = "0.11.2"
tracing-subscriber = { version = "0.3.16", features = ["env-filter", "tracing-log"] }
tracing-journald = "0.3.0"
tracing = "0.1.37"
tracing = { version = "0.1.37", features = ["max_level_debug", "release_max_level_info"] }
[dependencies.smithay]
version = "0.3"

View file

@ -57,7 +57,7 @@ use smithay::{
},
xwayland::XWaylandClientData,
};
use tracing::{debug, error, info, warn};
use tracing::{error, info, trace, warn};
use std::{
cell::RefCell,
@ -200,7 +200,7 @@ pub fn init_backend(
.with_context(|| format!("Failed to remove drm device: {}", device_id)),
} {
Ok(()) => {
debug!("Successfully handled udev event.")
trace!("Successfully handled udev event.")
}
Err(err) => {
error!(?err, "Error while handling udev event.")
@ -1133,7 +1133,7 @@ impl KmsState {
render,
surface,
) {
debug!(?err, "Early import failed.");
trace!(?err, "Early import failed.");
}
}

View file

@ -17,9 +17,9 @@ pub fn init_logger() -> Result<()> {
let filter = EnvFilter::try_from_default_env()
.unwrap_or_else(|_| {
EnvFilter::new(if cfg!(debug_assertions) {
"warn"
"info"
} else {
"error"
"warn"
})
})
.add_directive(Directive::from_str("cosmic_text=error").unwrap())

View file

@ -12,7 +12,7 @@ use smithay::{
utils::{IsAlive, Serial, SERIAL_COUNTER},
};
use std::cell::RefCell;
use tracing::{debug, info};
use tracing::{debug, trace};
use self::target::{KeyboardFocusTarget, WindowGroup};
@ -101,7 +101,7 @@ impl Shell {
if let Some(workspace) = state.common.shell.space_for_mut(mapped) {
let mut focus_stack = workspace.focus_stack.get_mut(active_seat);
if Some(mapped) != focus_stack.last() {
debug!(?mapped, "Focusing window.");
trace!(?mapped, "Focusing window.");
focus_stack.append(mapped);
// also remove popup grabs, if we are switching focus
if let Some(mut popup_grab) = active_seat
@ -203,7 +203,7 @@ impl Common {
{
continue; // Focus is valid
} else {
debug!("Wrong Window, focus fixup");
trace!("Wrong Window, focus fixup");
}
}
KeyboardFocusTarget::LayerSurface(layer) => {
@ -224,7 +224,7 @@ impl Common {
} // Focus is valid
};
} else {
debug!("Surface dead, focus fixup");
trace!("Surface dead, focus fixup");
}
} else {
continue;
@ -263,7 +263,7 @@ impl Common {
.map(KeyboardFocusTarget::from)
});
if let Some(keyboard) = seat.get_keyboard() {
info!("Restoring focus to {:?}", target.as_ref());
debug!("Restoring focus to {:?}", target.as_ref());
keyboard.set_focus(state, target.clone(), SERIAL_COUNTER.next_serial());
ActiveFocus::set(&seat, target);
}

View file

@ -31,7 +31,7 @@ use smithay::{
wayland::seat::WaylandFocus,
};
use std::{borrow::Borrow, collections::HashMap, hash::Hash, sync::Arc};
use tracing::debug;
use tracing::trace;
mod grabs;
pub use self::grabs::*;
@ -421,7 +421,7 @@ impl TilingLayout {
});
// remove self
debug!(?mapped, "Remove window.");
trace!(?mapped, "Remove window.");
let _ = tree.remove_node(node_id.clone(), RemoveBehavior::DropChildren);
// fixup parent node
@ -434,7 +434,7 @@ impl TilingLayout {
if group.len() > 2 {
group.remove_window(position);
} else {
debug!("Removing Group");
trace!("Removing Group");
let other_child =
tree.children_ids(&id).unwrap().cloned().next().unwrap();
let fork_pos = parent_parent_id.as_ref().and_then(|parent_id| {

View file

@ -24,7 +24,7 @@ use smithay::{
},
};
use std::sync::Mutex;
use tracing::{debug, warn};
use tracing::{trace, warn};
impl Shell {
pub fn unconstrain_popup(&self, surface: &PopupSurface, positioner: &PositionerState) {
@ -104,7 +104,7 @@ fn unconstrain_xdg_popup_tile(surface: &PopupSurface, rect: Rectangle<i32, Logic
let offset = check_constrained(geometry, rect);
if offset.x != 0 || offset.y != 0 {
debug!(?surface, "Unconstraining popup to tile.");
trace!(?surface, "Unconstraining popup to tile.");
if !unconstrain_flip(&surface, rect) {
return unconstrain_slide(&surface, rect);
// don't try to resize for fitting to a tile
@ -124,7 +124,7 @@ fn unconstrain_xdg_popup(
let offset = check_constrained(geometry, relative);
if offset.x != 0 || offset.y != 0 {
debug!(?surface, "Unconstraining popup.");
trace!(?surface, "Unconstraining popup.");
if !unconstrain_flip(&surface, relative) {
if !unconstrain_slide(&surface, relative) {
unconstrain_resize(&surface, relative);
@ -144,7 +144,7 @@ fn unconstrain_layer_popup(surface: &PopupSurface, output: &Output, layer_surfac
let offset = check_constrained(geometry, relative);
if offset.x != 0 || offset.y != 0 {
debug!(?surface, "Unconstraining popup.");
trace!(?surface, "Unconstraining popup.");
if !unconstrain_flip(&surface, relative) {
if !unconstrain_slide(&surface, relative) {
unconstrain_resize(&surface, relative);

View file

@ -27,7 +27,7 @@ use smithay::{
X11Surface, X11Wm, XWayland, XWaylandEvent, XwmHandler,
},
};
use tracing::{error, info, warn};
use tracing::{error, trace, warn};
pub struct XWaylandState {
pub xwm: Option<X11Wm>,
@ -489,7 +489,7 @@ impl XwmHandler for Data {
}
fn new_selection(&mut self, xwm: XwmId, selection: SelectionType, mime_types: Vec<String>) {
info!(?selection, ?mime_types, "Got Selection from Xwayland",);
trace!(?selection, ?mime_types, "Got Selection from Xwayland",);
if self.state.common.is_x_focused(xwm) {
let seat = self.state.common.last_active_seat();