Просмотр исходного кода

wallet: downgrade nearly all logs from debug to trace, and add a large list of targets to mute net/event_graph spam

darkfi 1 год назад
Родитель
Сommit
edd333a657

+ 15 - 11
bin/darkwallet/src/app/mod.rs

@@ -45,6 +45,10 @@ mod node;
 use node::create_darkirc;
 mod schema;
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "app", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "app", $($arg)*); } }
+macro_rules! i { ($($arg:tt)*) => { info!(target: "app", $($arg)*); } }
+
 const PLUGINS_ENABLED: bool = true;
 
 //fn print_type_of<T>(_: &T) {
@@ -93,7 +97,7 @@ impl AsyncRuntime {
     pub fn stop(&self) {
         // Go through event graph and call stop on everything
         // Depth first
-        debug!(target: "app", "Stopping async runtime...");
+        d!("Stopping async runtime...");
 
         let tasks = std::mem::take(&mut *self.tasks.lock().unwrap());
         // Close all tasks
@@ -114,7 +118,7 @@ impl AsyncRuntime {
         let exec_threadpool = std::mem::replace(&mut *self.exec_threadpool.lock().unwrap(), None);
         let exec_threadpool = exec_threadpool.expect("threadpool wasnt started");
         exec_threadpool.join().unwrap();
-        debug!(target: "app", "Stopped app");
+        i!("Stopped app");
     }
 }
 
@@ -150,7 +154,7 @@ impl App {
     /// Does not require miniquad to be init. Created the scene graph tree / schema and all
     /// the objects.
     pub async fn setup(&self) {
-        debug!(target: "app", "App::setup()");
+        t!("App::setup()");
 
         let mut window = SceneNode3::new("window", SceneNodeType3::Window);
 
@@ -167,7 +171,7 @@ impl App {
         schema::make(&self, window).await;
         //schema::test::make(&self, window).await;
 
-        debug!(target: "app", "Schema loaded");
+        d!("Schema loaded");
 
         let plugin = Arc::new(SceneNode3::new("plugin", SceneNodeType3::PluginRoot));
         self.sg_root.clone().link(plugin.clone());
@@ -197,9 +201,9 @@ impl App {
                 let msg = String::decode(&mut cur).unwrap();
 
                 let node_path = format!("/window/{channel}_chat_layer/content/chatty");
-                debug!(target: "app", "Attempting to relay message to {node_path}");
+                t!("Attempting to relay message to {node_path}");
                 let Some(chatview) = sg_root2.clone().lookup_node(&node_path) else {
-                    warn!(target: "app", "Ignoring message since {node_path} doesn't exist");
+                    d!("Ignoring message since {node_path} doesn't exist");
                     continue
                 };
 
@@ -245,12 +249,12 @@ impl App {
 
         plugin.link(darkirc);
 
-        debug!(target: "app", "Plugins loaded");
+        i!("Plugins loaded");
     }
 
     /// Begins the draw of the tree, and then starts the UI procs.
     pub async fn start(self: Arc<Self>) {
-        debug!(target: "app", "App::start()");
+        d!("Starting app");
 
         let window_node = self.sg_root.clone().lookup_node("/window").unwrap();
         let prop = window_node.get_property("screen_size").unwrap();
@@ -263,7 +267,7 @@ impl App {
         self.trigger_draw().await;
 
         self.start_procs().await;
-        debug!(target: "app", "App started");
+        i!("App started");
     }
 
     pub fn stop(&self) {
@@ -303,7 +307,7 @@ impl App {
 
 impl Drop for App {
     fn drop(&mut self) {
-        debug!(target: "app", "Dropping app");
+        t!("Dropping app");
         // This hangs
         //self.stop();
     }
@@ -339,5 +343,5 @@ fn populate_tree(tree: &sled::Tree) {
         tree.insert(&key, val).unwrap();
     }
     // O(n)
-    debug!(target: "app", "populated db with {} lines", tree.len());
+    d!("populated db with {} lines", tree.len());
 }

+ 13 - 11
bin/darkwallet/src/app/node.rs

@@ -26,8 +26,10 @@ use crate::{
     ExecutorPtr,
 };
 
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "app::node", $($arg)*); } }
+
 pub fn create_layer(name: &str) -> SceneNode {
-    debug!(target: "app", "create_layer({name})");
+    t!("create_layer({name})");
     let mut node = SceneNode::new(name, SceneNodeType::Layer);
     let prop = Property::new("is_visible", PropertyType::Bool, PropertySubType::Null);
     node.add_property(prop).unwrap();
@@ -47,7 +49,7 @@ pub fn create_layer(name: &str) -> SceneNode {
 }
 
 pub fn create_vector_art(name: &str) -> SceneNode {
-    debug!(target: "app", "create_vector_art({name})");
+    t!("create_vector_art({name})");
     let mut node = SceneNode::new(name, SceneNodeType::VectorArt);
 
     let mut prop = Property::new("is_visible", PropertyType::Bool, PropertySubType::Null);
@@ -69,7 +71,7 @@ pub fn create_vector_art(name: &str) -> SceneNode {
 }
 
 pub fn create_button(name: &str) -> SceneNode {
-    debug!(target: "app", "create_button({name})");
+    t!("create_button({name})");
     let mut node = SceneNode::new(name, SceneNodeType::Button);
 
     let mut prop = Property::new("is_active", PropertyType::Bool, PropertySubType::Null);
@@ -93,7 +95,7 @@ pub fn create_button(name: &str) -> SceneNode {
 }
 
 pub fn create_shortcut(name: &str) -> SceneNode {
-    debug!(target: "app", "create_shortcut({name})");
+    t!("create_shortcut({name})");
     let mut node = SceneNode::new(name, SceneNodeType::Shortcut);
 
     let mut prop = Property::new("key", PropertyType::Str, PropertySubType::Null);
@@ -109,7 +111,7 @@ pub fn create_shortcut(name: &str) -> SceneNode {
 }
 
 pub fn create_image(name: &str) -> SceneNode {
-    debug!(target: "app", "create_image({name})");
+    t!("create_image({name})");
     let mut node = SceneNode::new(name, SceneNodeType::Image);
 
     let mut prop = Property::new("rect", PropertyType::Float32, PropertySubType::Pixel);
@@ -137,7 +139,7 @@ pub fn create_image(name: &str) -> SceneNode {
 }
 
 pub fn create_text(name: &str) -> SceneNode {
-    debug!(target: "app", "create_text({name})");
+    t!("create_text({name})");
     let mut node = SceneNode::new(name, SceneNodeType::Text);
 
     let mut prop = Property::new("rect", PropertyType::Float32, PropertySubType::Pixel);
@@ -172,7 +174,7 @@ pub fn create_text(name: &str) -> SceneNode {
 }
 
 pub fn create_editbox(name: &str) -> SceneNode {
-    debug!(target: "app", "create_editbox({name})");
+    t!("create_editbox({name})");
     let mut node = SceneNode::new(name, SceneNodeType::EditBox);
 
     let mut prop = Property::new("is_active", PropertyType::Bool, PropertySubType::Null);
@@ -282,7 +284,7 @@ pub fn create_editbox(name: &str) -> SceneNode {
 }
 
 pub fn create_chatedit(name: &str) -> SceneNode {
-    debug!(target: "app", "create_chatedit({name})");
+    t!("create_chatedit({name})");
     let mut node = SceneNode::new(name, SceneNodeType::ChatEdit);
 
     let mut prop = Property::new("is_active", PropertyType::Bool, PropertySubType::Null);
@@ -428,7 +430,7 @@ pub fn create_chatedit(name: &str) -> SceneNode {
 }
 
 pub fn create_chatview(name: &str) -> SceneNode {
-    debug!(target: "app", "create_chatview({name})");
+    t!("create_chatview({name})");
     let mut node = SceneNode::new(name, SceneNodeType::ChatView);
 
     let mut prop = Property::new("rect", PropertyType::Float32, PropertySubType::Pixel);
@@ -538,7 +540,7 @@ pub fn create_chatview(name: &str) -> SceneNode {
 }
 
 pub fn create_emoji_picker(name: &str) -> SceneNode {
-    debug!(target: "app", "create_emoji_picker({name})");
+    t!("create_emoji_picker({name})");
     let mut node = SceneNode::new(name, SceneNodeType::EmojiPicker);
 
     let mut prop = Property::new("rect", PropertyType::Float32, PropertySubType::Pixel);
@@ -575,7 +577,7 @@ pub fn create_emoji_picker(name: &str) -> SceneNode {
 }
 
 pub fn create_darkirc(name: &str) -> SceneNode {
-    debug!(target: "app", "create_darkirc({name})");
+    t!("create_darkirc({name})");
     let mut node = SceneNode::new(name, SceneNodeType::Plugin);
 
     let mut prop = Property::new("nick", PropertyType::Str, PropertySubType::Null);

+ 1 - 1
bin/darkwallet/src/app/schema/chat.rs

@@ -550,7 +550,7 @@ pub async fn make(
     //if chat_tree.is_empty() {
     //    populate_tree(&chat_tree);
     //}
-    debug!(target: "app", "db has {} lines", chat_tree.len());
+    debug!(target: "app", "Loaded #{channel} history: {} lines", chat_tree.len());
     let chatview_node = node
         .setup(|me| {
             ChatView::new(

+ 2 - 1
bin/darkwallet/src/app/schema/test.rs

@@ -259,7 +259,8 @@ pub async fn make(app: &App, window: SceneNodePtr) {
     node.set_property_str(
         Role::App,
         "text",
-        "hel \u{01f3f3}\u{fe0f}\u{200d}\u{26a7}\u{fe0f} 123 '\u{01f44d}\u{01f3fe}' br",
+        "\u{f0007}",
+        //"hel \u{01f3f3}\u{fe0f}\u{200d}\u{26a7}\u{fe0f} 123 '\u{01f44d}\u{01f3fe}' br",
     )
     .unwrap();
     //node.set_property_str(Role::App, "text", "anon1").unwrap();

+ 25 - 18
bin/darkwallet/src/logger.rs

@@ -15,6 +15,24 @@ const LOGS_ENABLED: bool = true;
 // Measured in bytes
 const LOGFILE_MAXSIZE: usize = 5_000_000;
 
+static MUTED_TARGETS: &[&'static str] = &[
+    "sled",
+    "rustls",
+    "net::channel",
+    "net::message_publisher",
+    "net::hosts",
+    "net::protocol",
+    "net::session",
+    "net::outbound_session",
+    "net::tcp",
+    "net::p2p::seed",
+    "net::refinery::handshake_node()",
+    "system::publisher",
+    "event_graph::dag_sync()",
+    "event_graph::dag_insert()",
+    "event_graph::protocol",
+];
+
 #[cfg(target_os = "android")]
 fn logfile_path() -> PathBuf {
     use crate::android::get_external_storage_path;
@@ -48,16 +66,10 @@ mod android {
     impl Log for AndroidLoggerWrapper {
         fn enabled(&self, metadata: &Metadata<'_>) -> bool {
             let target = metadata.target();
-            if target.starts_with("sled") ||
-                target.starts_with("rustls") ||
-                target.starts_with("net::channel") ||
-                target.starts_with("net::message_publisher") ||
-                target.starts_with("net::hosts") ||
-                target.starts_with("net::protocol") ||
-                target.starts_with("net::session") ||
-                target.starts_with("event_graph::dag_sync")
-            {
-                return false
+            for muted in MUTED_TARGETS {
+                if target.starts_with(muted) {
+                    return false
+                }
             }
             if metadata.level() > self.level {
                 return false
@@ -94,14 +106,9 @@ pub fn setup_logging() {
     let mut loggers: Vec<Box<dyn SharedLogger>> = vec![];
 
     let mut cfg = ConfigBuilder::new();
-    cfg.add_filter_ignore_str("sled");
-    cfg.add_filter_ignore_str("rustls");
-    cfg.add_filter_ignore_str("net::channel");
-    cfg.add_filter_ignore_str("net::message_publisher");
-    cfg.add_filter_ignore_str("net::hosts");
-    cfg.add_filter_ignore_str("net::protocol");
-    cfg.add_filter_ignore_str("net::session");
-    cfg.add_filter_ignore_str("event_graph::dag_sync");
+    for target in MUTED_TARGETS {
+        cfg.add_filter_ignore_str(target);
+    }
     let cfg = cfg.build();
 
     if LOGS_ENABLED {

+ 19 - 18
bin/darkwallet/src/plugin/darkirc.rs

@@ -103,9 +103,10 @@ mod paths {
 
 use paths::*;
 
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "plugin::darkirc", $($arg)*); } }
 macro_rules! d { ($($arg:tt)*) => { debug!(target: "plugin::darkirc", $($arg)*); } }
-macro_rules! inf { ($($arg:tt)*) => { info!(target: "plugin::darkirc", $($arg)*); } }
-macro_rules! err { ($($arg:tt)*) => { error!(target: "plugin::darkirc", $($arg)*); } }
+macro_rules! i { ($($arg:tt)*) => { info!(target: "plugin::darkirc", $($arg)*); } }
+macro_rules! e { ($($arg:tt)*) => { error!(target: "plugin::darkirc", $($arg)*); } }
 
 #[derive(Clone, Debug, SerialEncodable, SerialDecodable)]
 pub struct Privmsg {
@@ -174,12 +175,12 @@ impl DarkIrc {
         let node_ref = &node.upgrade().unwrap();
         let nick = PropertyStr::wrap(node_ref, Role::Internal, "nick", 0).unwrap();
 
-        inf!("Starting DarkIRC backend");
+        i!("Starting DarkIRC backend");
         let evgr_path = get_evgrdb_path();
         let db = match sled::open(&evgr_path) {
             Ok(db) => db,
             Err(err) => {
-                err!("Sled database '{}' failed to open: {err}!", evgr_path.display());
+                e!("Sled database '{}' failed to open: {err}!", evgr_path.display());
                 return Err(Error::SledDbErr);
             }
         };
@@ -197,7 +198,7 @@ impl DarkIrc {
         let p2p = match P2p::new(p2p_settings, ex.clone()).await {
             Ok(p2p) => p2p,
             Err(err) => {
-                err!("Create p2p network failed: {err}!");
+                e!("Create p2p network failed: {err}!");
                 return Err(Error::ServiceFailed);
             }
         };
@@ -215,7 +216,7 @@ impl DarkIrc {
         {
             Ok(evgr) => evgr,
             Err(err) => {
-                err!("Create event graph failed: {err}!");
+                e!("Create event graph failed: {err}!");
                 return Err(Error::ServiceFailed);
             }
         };
@@ -239,22 +240,22 @@ impl DarkIrc {
     }
 
     async fn dag_sync(self: Arc<Self>, channel_sub: Subscription<DarkFiResult<ChannelPtr>>) {
-        inf!("Starting p2p network");
+        i!("Starting p2p network");
         while let Err(err) = self.p2p.clone().start().await {
             // This usually means we cannot listen on the inbound ports
-            err!("Failed to start p2p network: {err}!");
-            err!("Usually this means there is another process listening on the same ports.");
-            err!("Trying again in {P2P_RETRY_TIME} secs");
+            e!("Failed to start p2p network: {err}!");
+            e!("Usually this means there is another process listening on the same ports.");
+            e!("Trying again in {P2P_RETRY_TIME} secs");
             sleep(P2P_RETRY_TIME).await;
         }
 
-        inf!("Waiting for some P2P connections...");
+        i!("Waiting for some P2P connections...");
 
         let mut sync_attempt = 0;
         loop {
             // Wait for a channel
             if let Err(_) = channel_sub.receive().await {
-                err!("There was an error listening for channels. The service closed unexpectedly.");
+                e!("There was an error listening for channels. The service closed unexpectedly.");
                 // Not sure what to do here
                 return
             }
@@ -268,12 +269,12 @@ impl DarkIrc {
 
             // Cool off periodically
             if sync_attempt > COOLOFF_SYNC_ATTEMPTS {
-                inf!("Wasn't able to sync yet. Cooling off for {COOLOFF_SLEEP_TIME} then will try again.");
+                i!("Wasn't able to sync yet. Cooling off for {COOLOFF_SLEEP_TIME} then will try again.");
                 sleep(COOLOFF_SLEEP_TIME).await;
                 sync_attempt = 0;
             }
 
-            inf!("Syncing event DAG (attempt #{sync_attempt})");
+            i!("Syncing event DAG (attempt #{sync_attempt})");
             match self.event_graph.dag_sync().await {
                 Ok(()) => break,
                 Err(e) => {
@@ -293,14 +294,14 @@ impl DarkIrc {
             let privmsg: Privmsg = match deserialize_async(ev.content()).await {
                 Ok(v) => v,
                 Err(e) => {
-                    err!("[IRC CLIENT] Failed deserializing incoming Privmsg event: {}", e);
+                    e!("[IRC CLIENT] Failed deserializing incoming Privmsg event: {}", e);
                     continue
                 }
             };
 
             let mut timest = ev.timestamp;
             let msg_id = privmsg.msg_id(timest);
-            inf!(
+            t!(
                 "Relaying ev_id={:?}, ev={ev:?}, msg_id={msg_id}, privmsg={privmsg:?}, timest={timest}",
                 ev.id(),
             );
@@ -379,7 +380,7 @@ impl DarkIrc {
         }
 
         let Ok((timest, channel, msg)) = decode_data(&method_call.data) else {
-            err!("send() method invalid arg data");
+            e!("send() method invalid arg data");
             return true
         };
 
@@ -430,7 +431,7 @@ impl DarkIrc {
 #[async_trait]
 impl PluginObject for DarkIrc {
     async fn start(self: Arc<Self>, ex: ExecutorPtr) {
-        inf!("Registering EventGraph P2P protocol");
+        i!("Registering EventGraph P2P protocol");
         let event_graph_ = Arc::clone(&self.event_graph);
         let registry = self.p2p.protocol_registry();
         registry

+ 5 - 2
bin/darkwallet/src/scene.rs

@@ -37,6 +37,8 @@ use crate::{
     ui,
 };
 
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "scene", $($arg)*); } }
+
 pub struct ScenePath(VecDeque<String>);
 
 impl<S: Into<String>> From<S> for ScenePath {
@@ -295,18 +297,19 @@ impl SceneNode {
     }
 
     pub async fn trigger(&self, sig_name: &str, data: Vec<u8>) -> Result<()> {
+        t!("trigger({sig_name}, {data:?}) [node={self:?}]");
         let sig = self.get_signal(sig_name).ok_or(Error::SignalNotFound)?;
         let futures = FuturesUnordered::new();
         let slots: Vec<_> = sig.slots.read().unwrap().values().cloned().collect();
         // TODO: autoremove failed slots
         for slot in slots {
-            debug!(target: "scene", "triggering {}", slot.name);
+            t!("  triggering {}", slot.name);
             // Trigger the slot
             let data = data.clone();
             futures.push(async move { slot.notify.send(data).await.is_ok() });
         }
         let success: Vec<_> = futures.collect().await;
-        debug!(target: "scene", "trigger success: {success:?}");
+        t!("trigger success: {success:?}");
         Ok(())
     }
 

+ 8 - 3
bin/darkwallet/src/ui/button.rs

@@ -33,6 +33,9 @@ use crate::{
 
 use super::{DrawUpdate, UIObject};
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "app", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "app", $($arg)*); } }
+
 pub type ButtonPtr = Arc<Button>;
 
 pub struct Button {
@@ -48,7 +51,7 @@ pub struct Button {
 
 impl Button {
     pub async fn new(node: SceneNodeWeak, ex: ExecutorPtr) -> Pimpl {
-        debug!(target: "ui::button", "Button::new()");
+        t!("Button::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let is_active = PropertyBool::wrap(node_ref, Role::Internal, "is_active", 0).unwrap();
@@ -99,6 +102,7 @@ impl UIObject for Button {
     }
 
     async fn handle_mouse_btn_up(&self, btn: MouseButton, mouse_pos: Point) -> bool {
+        t!("handle_mouse_btn_up({btn:?}, {mouse_pos:?})");
         if !self.is_active.get() {
             return false
         }
@@ -119,7 +123,7 @@ impl UIObject for Button {
             return false
         }
 
-        debug!(target: "ui::button", "Button clicked!");
+        d!("Button clicked!");
         let node = self.node.upgrade().unwrap();
         node.trigger("click", vec![]).await.unwrap();
 
@@ -127,6 +131,7 @@ impl UIObject for Button {
     }
 
     async fn handle_touch(&self, phase: TouchPhase, id: u64, touch_pos: Point) -> bool {
+        t!("handle_touch({phase:?}, {id}, {touch_pos:?})");
         if !self.is_active.get() {
             return false
         }
@@ -138,7 +143,7 @@ impl UIObject for Button {
 
         let rect = self.rect.get();
         if !rect.contains(touch_pos) {
-            //debug!(target: "ui::chatview", "not inside rect");
+            t!("not inside rect");
             return false
         }
 

+ 32 - 32
bin/darkwallet/src/ui/chatedit.rs

@@ -67,6 +67,7 @@ use super::{
 const VERT_SCROLL_UPDATE_INC: f32 = 1.;
 
 macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::chatview", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::chatview", $($arg)*); } }
 
 fn is_all_whitespace(glyphs: &[Glyph]) -> bool {
     for glyph in glyphs {
@@ -523,7 +524,7 @@ impl ChatEdit {
         text_shaper: TextShaperPtr,
         ex: ExecutorPtr,
     ) -> Pimpl {
-        debug!(target: "ui::chatedit", "ChatEdit::new()");
+        t!("ChatEdit::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let is_active = PropertyBool::wrap(node_ref, Role::Internal, "is_active", 0).unwrap();
@@ -1086,20 +1087,20 @@ impl ChatEdit {
         if !self.is_active.get() {
             return
         }
-        debug!(target: "ui::chatedit", "Focus changed");
+        t!("Focus changed");
 
         // Cursor visibility will change so just redraw everything lol
         self.redraw().await;
     }
 
     async fn insert_char(&self, key: char) {
-        debug!(target: "ui::chatedit", "insert_char({key})");
+        t!("insert_char({key})");
         let mut tmp = [0; 4];
         let key_str = key.encode_utf8(&mut tmp);
         self.insert_text(key_str).await
     }
     async fn insert_text(&self, text: &str) {
-        //debug!(target: "ui::chatedit", "insert_text({text})");
+        t!("insert_text({text})");
         let text = {
             let mut text_wrap = &mut self.text_wrap.lock();
             text_wrap.clear_cache();
@@ -1122,7 +1123,7 @@ impl ChatEdit {
     }
 
     async fn handle_shortcut(&self, key: char, mods: &KeyMods) -> bool {
-        debug!(target: "ui::chatedit", "handle_shortcut({:?}, {:?})", key, mods);
+        t!("handle_shortcut({:?}, {:?})", key, mods);
 
         match key {
             'a' => {
@@ -1164,7 +1165,7 @@ impl ChatEdit {
     }
 
     async fn handle_key(&self, key: &KeyCode, mods: &KeyMods) -> bool {
-        debug!(target: "ui::chatedit", "handle_key({:?}, {:?})", key, mods);
+        t!("handle_key({:?}, {:?})", key, mods);
         match key {
             KeyCode::Left => {
                 if !self.adjust_cursor(&mods, |editable| editable.move_cursor(-1)) {
@@ -1294,7 +1295,7 @@ impl ChatEdit {
         let prev_cursor_pos = text_wrap.editable.get_cursor_pos(&rendered);
         move_cursor(&mut text_wrap.editable);
         let cursor_pos = text_wrap.editable.get_cursor_pos(&rendered);
-        debug!(target: "ui::editbox", "Adjust cursor pos to {cursor_pos}");
+        d!("Adjust cursor pos to {cursor_pos}");
 
         let select = &mut text_wrap.select;
 
@@ -1338,7 +1339,7 @@ impl ChatEdit {
             self.hide_cursor.store(true, Ordering::Relaxed);
         }
 
-        debug!(target: "ui::chatview", "Selected {select:?} from {touch_pos:?}");
+        d!("Selected {select:?} from {touch_pos:?}");
         self.update_select_text(&mut text_wrap);
     }
 
@@ -1414,7 +1415,7 @@ impl ChatEdit {
     */
 
     async fn handle_touch_start(&self, mut touch_pos: Point) -> bool {
-        //debug!(target: "ui::chatedit", "handle_touch_start({touch_pos:?})");
+        t!("handle_touch_start({touch_pos:?})");
         let mut touch_info = self.touch_info.lock();
 
         if self.try_handle_drag(&mut touch_info, touch_pos) {
@@ -1465,18 +1466,18 @@ impl ChatEdit {
             p2.y = line_idx as f32 * linespacing + handle_off_y;
 
             // Are we within range of either one?
-            //debug!(target: "ui::chatedit", "handle center points = ({p1:?}, {p2:?})");
+            t!("handle center points = ({p1:?}, {p2:?})");
 
             const TOUCH_RADIUS_SQ: f32 = 10_000.;
 
             if p1.dist_sq(&touch_pos) <= TOUCH_RADIUS_SQ {
-                debug!(target: "ui::chatedit::touch", "start touch: DragSelectHandle state [side=-1]");
+                d!("start touch: DragSelectHandle state [side=-1]");
                 // Set touch_state status to enable begin dragging them
                 touch_info.state = TouchStateAction::DragSelectHandle { side: -1 };
                 return true;
             }
             if p2.dist_sq(&touch_pos) <= TOUCH_RADIUS_SQ {
-                debug!(target: "ui::chatedit::touch", "start touch: DragSelectHandle state [side=1]");
+                d!("start touch: DragSelectHandle state [side=1]");
                 // Set touch_state status to enable begin dragging them
                 touch_info.state = TouchStateAction::DragSelectHandle { side: 1 };
                 return true;
@@ -1487,7 +1488,7 @@ impl ChatEdit {
     }
 
     async fn handle_touch_move(&self, mut touch_pos: Point) -> bool {
-        //debug!(target: "ui::chatedit", "handle_touch_move({touch_pos:?})");
+        t!("handle_touch_move({touch_pos:?})");
         // We must update with non relative touch_pos bcos when doing vertical scrolling
         // we will modify the scroll, which is used by abs_to_local(), which is used
         // to then calculate the max scroll. So it ends up jumping around.
@@ -1508,7 +1509,7 @@ impl ChatEdit {
                     self.start_touch_select(touch_pos);
                     self.redraw().await;
                 }
-                debug!(target: "ui::chatedit::touch", "touch state: StartSelect -> Select");
+                d!("touch state: StartSelect -> Select");
                 self.touch_info.lock().state = TouchStateAction::Select;
             }
             TouchStateAction::DragSelectHandle { side } => {
@@ -1583,7 +1584,7 @@ impl ChatEdit {
         true
     }
     async fn handle_touch_end(&self, mut touch_pos: Point) -> bool {
-        //debug!(target: "ui::chatedit", "handle_touch_end({touch_pos:?})");
+        t!("handle_touch_end({touch_pos:?})");
         self.abs_to_local(&mut touch_pos);
 
         let state = self.touch_info.lock().stop();
@@ -1602,7 +1603,7 @@ impl ChatEdit {
     }
 
     async fn touch_set_cursor_pos(&self, mut touch_pos: Point) {
-        debug!(target: "ui::chatedit", "touch_set_cursor_pos({touch_pos:?})");
+        t!("touch_set_cursor_pos({touch_pos:?})");
         let width = self.wrap_width();
         {
             let mut text_wrap = self.text_wrap.lock();
@@ -1710,7 +1711,7 @@ impl ChatEdit {
 
     async fn redraw(&self) {
         let timest = unixtime();
-        //debug!(target: "ui::chatedit", "redraw()");
+        t!("redraw()");
         let Some(draw_update) = self.make_draw_calls() else {
             error!(target: "ui::chatedit", "Text failed to draw");
             return;
@@ -1803,7 +1804,7 @@ impl ChatEdit {
             return false
         };
 
-        //debug!(target: "ui::chatview", "method called: insert_line({method_call:?})");
+        t!("method called: insert_line({method_call:?})");
         assert!(method_call.send_res.is_none());
 
         fn decode_data(data: &[u8]) -> std::io::Result<String> {
@@ -1944,14 +1945,14 @@ impl UIObject for ChatEdit {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        debug!(target: "ui::chatedit", "ChatEdit::draw({:?})", self.node.upgrade().unwrap());
+        t!("ChatEdit::draw({:?})", self.node.upgrade().unwrap());
         *self.parent_rect.lock() = Some(parent_rect);
 
         self.make_draw_calls()
     }
 
     async fn handle_char(&self, key: char, mods: KeyMods, repeat: bool) -> bool {
-        //debug!(target: "ui::chatedit", "handle_char({key}, {mods:?}, {repeat})");
+        t!("handle_char({key}, {mods:?}, {repeat})");
         // First filter for only single digit keys
         if DISALLOWED_CHARS.contains(&key) {
             return false
@@ -1976,7 +1977,7 @@ impl UIObject for ChatEdit {
             return self.handle_shortcut(key, &mods).await
         }
 
-        //debug!(target: "ui::chatedit", "Key {:?} has {} actions", key, actions);
+        t!("Key {:?} has {} actions", key, actions);
         for _ in 0..actions {
             self.insert_char(key).await;
         }
@@ -1984,7 +1985,7 @@ impl UIObject for ChatEdit {
     }
 
     async fn handle_key_down(&self, key: KeyCode, mods: KeyMods, repeat: bool) -> bool {
-        //debug!(target: "ui::chatedit", "handle_key_down({key:?}, {mods:?}, {repeat})")
+        t!("handle_key_down({key:?}, {mods:?}, {repeat})");
         // First filter for only single digit keys
         // Avoid processing events handled by insert_char()
         if !ALLOWED_KEYCODES.contains(&key) {
@@ -2001,9 +2002,9 @@ impl UIObject for ChatEdit {
         };
 
         // Suppress noisy message
-        //if actions > 0 {
-        //    debug!(target: "ui::chatedit", "Key {:?} has {} actions", key, actions);
-        //}
+        if actions > 0 {
+            t!("Key {:?} has {} actions", key, actions);
+        }
 
         let mut is_handled = false;
         for _ in 0..actions {
@@ -2040,9 +2041,9 @@ impl UIObject for ChatEdit {
         // 1. make it active
         // 2. begin selection
         if self.is_focused.get() {
-            debug!(target: "ui::chatedit", "ChatEdit clicked");
+            d!("ChatEdit clicked");
         } else {
-            debug!(target: "ui::chatedit", "ChatEdit focused");
+            d!("ChatEdit focused");
             self.is_focused.set(true);
         }
 
@@ -2055,7 +2056,7 @@ impl UIObject for ChatEdit {
             let mut text_wrap = self.text_wrap.lock();
             let cursor_pos = text_wrap.set_cursor_with_point(mouse_pos, width);
             self.update_cursor_pos(&mut text_wrap);
-            debug!(target: "ui::editbox", "Mouse move cursor pos to {cursor_pos}");
+            d!("Mouse move cursor pos to {cursor_pos}");
 
             // begin selection
             let select = &mut text_wrap.select;
@@ -2126,7 +2127,6 @@ impl UIObject for ChatEdit {
     }
 
     async fn handle_mouse_wheel(&self, wheel_pos: Point) -> bool {
-        //debug!(target: "ui::chatedit", "rect={rect:?}, wheel_pos={wheel_pos:?}");
         if !self.is_mouse_hover.load(Ordering::Relaxed) {
             return false
         }
@@ -2138,7 +2138,7 @@ impl UIObject for ChatEdit {
 
         let mut scroll = self.scroll.get() - wheel_pos.y * self.scroll_speed.get();
         scroll = scroll.clamp(0., max_scroll);
-        debug!(target: "ui::chatedit", "handle_mouse_wheel({wheel_pos:?}) [scroll={scroll}]");
+        t!("handle_mouse_wheel({wheel_pos:?}) [scroll={scroll}]");
         self.scroll.set(scroll);
         self.redraw().await;
 
@@ -2164,7 +2164,7 @@ impl UIObject for ChatEdit {
     }
 
     async fn handle_compose_text(&self, suggest_text: &str, is_commit: bool) -> bool {
-        debug!(target: "ui::chatedit", "handle_compose_text({suggest_text}, {is_commit})");
+        t!("handle_compose_text({suggest_text}, {is_commit})");
 
         if !self.is_active.get() {
             return false
@@ -2186,7 +2186,7 @@ impl UIObject for ChatEdit {
         true
     }
     async fn handle_set_compose_region(&self, start: usize, end: usize) -> bool {
-        debug!(target: "ui::chatedit", "handle_set_compose_region({start}, {end})");
+        t!("handle_set_compose_region({start}, {end})");
 
         if !self.is_active.get() {
             return false

+ 34 - 29
bin/darkwallet/src/ui/chatview/mod.rs

@@ -57,6 +57,9 @@ use crate::{
 
 use super::{DrawUpdate, OnModify, UIObject};
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::chatview", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::chatview", $($arg)*); } }
+
 const EPSILON: f32 = 0.001;
 const BIG_EPSILON: f32 = 0.05;
 
@@ -194,7 +197,7 @@ impl ChatView {
         text_shaper: TextShaperPtr,
         ex: ExecutorPtr,
     ) -> Pimpl {
-        debug!(target: "ui::chatview", "ChatView::new()");
+        t!("ChatView::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let rect = PropertyRect::wrap(node_ref, Role::Internal, "rect").unwrap();
@@ -284,11 +287,11 @@ impl ChatView {
 
     async fn process_insert_line_method(me: &Weak<Self>, sub: &MethodCallSub) -> bool {
         let Ok(method_call) = sub.receive().await else {
-            debug!(target: "ui::chatview", "Event relayer closed");
+            d!("Event relayer closed");
             return false
         };
 
-        //debug!(target: "ui::chatview", "method called: insert_line({method_call:?})");
+        t!("method called: insert_line({method_call:?})");
         assert!(method_call.send_res.is_none());
 
         fn decode_data(data: &[u8]) -> std::io::Result<(Timestamp, MessageId, String, String)> {
@@ -315,11 +318,11 @@ impl ChatView {
     }
     async fn process_insert_unconf_line_method(me: &Weak<Self>, sub: &MethodCallSub) -> bool {
         let Ok(method_call) = sub.receive().await else {
-            debug!(target: "ui::chatview", "Event relayer closed");
+            d!("Event relayer closed");
             return false
         };
 
-        //debug!(target: "ui::chatview", "method called: insert_unconf_line({method_call:?})");
+        t!("method called: insert_unconf_line({method_call:?})");
         assert!(method_call.send_res.is_none());
 
         fn decode_data(data: &[u8]) -> std::io::Result<(Timestamp, MessageId, String, String)> {
@@ -390,7 +393,7 @@ impl ChatView {
 
         let accel = self.scroll_start_accel.get() * dist / time;
         let touch_time = touch_info.start_instant.elapsed();
-        //debug!(target: "ui::chatview", "accel = {dist} / {time} = {accel},  touch = {touch_time:?}");
+        t!("accel = {dist} / {time} = {accel},  touch = {touch_time:?}");
         self.speed.fetch_add(accel, Ordering::Relaxed);
         self.motion_cv.notify();
     }
@@ -431,7 +434,7 @@ impl ChatView {
         nick: String,
         text: String,
     ) {
-        debug!(target: "ui::chatview", "handle_insert_line({timest}, {msg_id}, {nick}, {text})");
+        t!("handle_insert_line({timest}, {msg_id}, {nick}, {text})");
 
         // Lock message buffer so background loader doesn't load the message as soon as it's
         // inserted into the DB.
@@ -439,7 +442,7 @@ impl ChatView {
 
         if !self.add_line_to_db(timest, &msg_id, &nick, &text).await {
             // Already exists so bail
-            debug!(target: "ui::chatview", "duplicate msg so bailing");
+            t!("duplicate msg so bailing");
             return
         }
 
@@ -447,9 +450,9 @@ impl ChatView {
         if msgbuf.mark_confirmed(&msg_id) {
             // Message already exists. Which means it must be an unconfirmed sent message.
             // Mark it as confirmed.
-            debug!(target: "ui::chatview", "Mark sent message as confirmed");
+            t!("Mark sent message as confirmed");
         } else {
-            debug!(target: "ui::chatview", "Inserting new message");
+            t!("Inserting new message");
             // Insert the privmsg since it doesn't already exist
             if msgbuf.insert_privmsg(timest, msg_id, nick, text).is_none() {
                 // Not visible so no need to redraw
@@ -467,7 +470,7 @@ impl ChatView {
         nick: String,
         text: String,
     ) {
-        debug!(target: "ui::chatview", "handle_insert_unconf_line({timest}, {msg_id}, {nick}, {text})");
+        t!("handle_insert_unconf_line({timest}, {msg_id}, {nick}, {text})");
 
         // We don't add unconfirmed lines to the db. Maybe we should?
 
@@ -524,7 +527,7 @@ impl ChatView {
     }
 
     async fn handle_bgload(&self) {
-        //debug!(target: "ui::chatview", "ChatView::handle_bgload()");
+        t!("ChatView::handle_bgload()");
         // Do we need to load some more?
         let scroll = self.scroll.get();
         let rect = self.rect.get();
@@ -537,20 +540,20 @@ impl ChatView {
         let total_height = msgbuf.calc_total_height().await;
         if total_height > top + preload_height {
             // Nothing to do here
-            //debug!(target: "ui::chatview", "bgloader: buffer is sufficient");
+            t!("bgloader: buffer is sufficient");
             return
         }
 
         // Keep loading until this is below 0
         let mut remaining_load_height = top + preload_height - total_height;
-        //debug!(target: "ui::chatview", "bgloader: remaining px = {remaining_load_height}");
+        t!("bgloader: remaining px = {remaining_load_height}");
         let mut remaining_visible = top - total_height;
 
         // Get the current earliest timestamp
         let iter = match msgbuf.oldest_timestamp() {
             Some(oldest_timest) => {
                 // iterate from there
-                //debug!(target: "ui::chatview", "preloading from {oldest_timest}");
+                t!("preloading from {oldest_timest}");
                 let timest = (oldest_timest - 1).to_be_bytes();
                 let mut key = [0u8; 8 + 32];
                 key[..8].clone_from_slice(&timest);
@@ -559,7 +562,7 @@ impl ChatView {
                 iter
             }
             None => {
-                //debug!(target: "ui::chatview", "initial load");
+                t!("initial load");
                 self.tree.iter().rev()
             }
         };
@@ -572,7 +575,7 @@ impl ChatView {
             let msg_id = MessageId(k[8..].try_into().unwrap());
             let timest = Timestamp::from_be_bytes(timest_bytes);
             let chatmsg: ChatMsg = deserialize(&v).unwrap();
-            //debug!(target: "ui::chatview", "{timest:?} {chatmsg:?}");
+            t!("{timest:?} {chatmsg:?}");
 
             let msg_height = msgbuf.push_privmsg(timest, msg_id, chatmsg.nick, chatmsg.text);
 
@@ -593,7 +596,7 @@ impl ChatView {
     }
 
     async fn scrollview(&self, mut scroll: f32) -> f32 {
-        //debug!(target: "ui::chatview", "scrollview()");
+        t!("scrollview()");
         let old_scroll = self.scroll.get();
 
         let rect = self.rect.get();
@@ -680,7 +683,7 @@ impl ChatView {
     }
 
     async fn redraw_cached(&self, msgbuf: &mut MessageBuffer) {
-        //debug!(target: "ui::chatview", "ChatView::redraw_cached()");
+        t!("ChatView::redraw_cached()");
         let timest = unixtime();
         let rect = self.rect.get();
 
@@ -693,12 +696,12 @@ impl ChatView {
             vec![(self.dc_key, GfxDrawCall { instrs, dcs: vec![], z_index: self.z_index.get() })];
 
         self.render_api.replace_draw_calls(timest, draw_calls);
-        //debug!(target: "ui::chatview", "ChatView::redraw_cached() DONE");
+        t!("ChatView::redraw_cached() DONE");
     }
 
     /// Invalidates cache and redraws everything
     async fn redraw_all(&self) {
-        //debug!(target: "ui::chatview", "ChatView::redraw_all()");
+        t!("ChatView::redraw_all()");
         let parent_rect = self.parent_rect.lock().unwrap().unwrap().clone();
         self.rect.eval(&parent_rect).expect("unable to eval rect");
 
@@ -706,7 +709,7 @@ impl ChatView {
         msgbuf.adjust_params();
         msgbuf.clear_meshes();
         self.redraw_cached(&mut msgbuf).await;
-        //debug!(target: "ui::chatview", "ChatView::redraw_all() DONE");
+        t!("ChatView::redraw_all() DONE");
     }
 }
 
@@ -799,7 +802,7 @@ impl UIObject for ChatView {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        debug!(target: "ui::chatview", "ChatView::draw({:?})", self.node.upgrade().unwrap());
+        t!("ChatView::draw({:?})", self.node.upgrade().unwrap());
 
         *self.parent_rect.lock().unwrap() = Some(parent_rect.clone());
         self.rect.eval(&parent_rect).ok()?;
@@ -872,6 +875,8 @@ impl UIObject for ChatView {
     }
 
     async fn handle_mouse_btn_up(&self, btn: MouseButton, mouse_pos: Point) -> bool {
+        t!("handle_mouse_btn_up({btn:?}, {mouse_pos:?})");
+
         if btn != MouseButton::Left {
             return false
         }
@@ -881,7 +886,7 @@ impl UIObject for ChatView {
     }
 
     async fn handle_mouse_move(&self, mouse_pos: Point) -> bool {
-        //debug!(target: "ui::chatview", "handle_mouse_move({mouse_x}, {mouse_y})");
+        t!("handle_mouse_move({mouse_pos:?})");
 
         // We store the mouse pos for use in handle_mouse_wheel()
         *self.mouse_pos.lock().unwrap() = mouse_pos.clone();
@@ -902,13 +907,13 @@ impl UIObject for ChatView {
     }
 
     async fn handle_mouse_wheel(&self, wheel_pos: Point) -> bool {
-        //debug!(target: "ui::chatview", "handle_mouse_wheel({wheel_x}, {wheel_y})");
+        t!("handle_mouse_wheel({wheel_pos:?})");
 
         let rect = self.rect.get();
 
         let mouse_pos = self.mouse_pos.lock().unwrap().clone();
         if !rect.contains(mouse_pos) {
-            //debug!(target: "ui::chatview", "not inside rect");
+            t!("not inside rect");
             return false
         }
 
@@ -923,7 +928,7 @@ impl UIObject for ChatView {
         }
 
         let rect = self.rect.get();
-        //debug!(target: "ui::chatview", "handle_touch({phase:?}, {touch_x}, {touch_y})");
+        t!("handle_touch({phase:?}, {id},{id},  {touch_pos:?})");
 
         let touch_y = touch_pos.y;
 
@@ -978,12 +983,12 @@ impl UIObject for ChatView {
                     (start_scroll, start_y, start_elapsed, do_update, is_select_mode)
                 };
 
-                //debug!(target: "ui::chatview", "touch phase moved, is_select_mode={is_select_mode:?}");
+                t!("touch phase moved, is_select_mode={is_select_mode:?}");
 
                 // When scrolling if we suddenly grab the screen for more than a brief period
                 // of time then stop the scrolling completely.
                 if start_elapsed > 200. {
-                    //debug!(target: "ui::chatview", "Stopping scroll accel");
+                    t!("Stopping scroll accel");
                     self.speed.store(0., Ordering::Relaxed);
                 }
 

+ 31 - 33
bin/darkwallet/src/ui/editbox/mod.rs

@@ -57,6 +57,9 @@ use editable::{Editable, Selection, TextIdx, TextPos};
 pub mod repeat;
 use repeat::{PressedKey, PressedKeysSmoothRepeat};
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::editbox", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::editbox", $($arg)*); } }
+
 // EOL whitespace is given a nudge since it has a width of 0 after text shaping
 const CURSOR_EOL_WS_NUDGE: f32 = 0.8;
 // EOL chars are more aesthetic when given a smallish nudge
@@ -105,7 +108,7 @@ impl TouchInfo {
     }
 
     fn start(&mut self, pos: Point) {
-        debug!(target: "ui::editbox", "TouchStateAction::Started");
+        d!("TouchStateAction::Started");
         self.state = TouchStateAction::Started { pos, instant: std::time::Instant::now() };
     }
 
@@ -122,11 +125,11 @@ impl TouchInfo {
 
                 if travel_dist < 5. {
                     if elapsed > 1000 {
-                        debug!(target: "ui::editbox", "TouchStateAction::StartSelect");
+                        d!("TouchStateAction::StartSelect");
                         self.state = TouchStateAction::StartSelect;
                     }
                 } else if x_dist.abs() > 5. {
-                    debug!(target: "ui::editbox", "TouchStateAction::ScrollHoriz");
+                    d!("TouchStateAction::ScrollHoriz");
                     let scroll_start = self.scroll.get();
                     self.state =
                         TouchStateAction::ScrollHoriz { start_pos: *start_pos, scroll_start };
@@ -204,7 +207,7 @@ impl EditBox {
         text_shaper: TextShaperPtr,
         ex: ExecutorPtr,
     ) -> Pimpl {
-        debug!(target: "ui::editbox", "EditBox::new()");
+        t!("EditBox::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let is_active = PropertyBool::wrap(node_ref, Role::Internal, "is_active", 0).unwrap();
@@ -522,7 +525,7 @@ impl EditBox {
     }
 
     fn draw_phone_select_handle(&self, mesh: &mut MeshBuilder, x: f32, side: f32) {
-        debug!(target: "ui::editbox", "draw_phone_select_handle(..., {x}, {side})");
+        t!("draw_phone_select_handle(..., {x}, {side})");
 
         let baseline = self.baseline.get();
         let select_ascent = self.select_ascent.get();
@@ -616,7 +619,7 @@ impl EditBox {
         if !self.is_active.get() {
             return
         }
-        debug!(target: "ui::editbox", "Focus changed");
+        d!("Focus changed");
 
         // Cursor visibility will change so just redraw everything lol
         self.redraw().await;
@@ -635,7 +638,7 @@ impl EditBox {
     }
 
     async fn handle_shortcut(&self, key: char, mods: &KeyMods) {
-        debug!(target: "ui::editbox", "handle_shortcut({:?}, {:?})", key, mods);
+        t!("handle_shortcut({:?}, {:?})", key, mods);
 
         match key {
             'c' => {
@@ -655,7 +658,7 @@ impl EditBox {
     }
 
     async fn handle_key(&self, key: &KeyCode, mods: &KeyMods) {
-        debug!(target: "ui::editbox", "handle_key({:?}, {:?})", key, mods);
+        t!("handle_key({:?}, {:?})", key, mods);
         match key {
             KeyCode::Left => {
                 self.adjust_cursor(mods.shift, |editable| editable.move_cursor(-1));
@@ -848,11 +851,7 @@ impl EditBox {
         glyphs.drain(sel_start..sel_end);
 
         let text = Self::glyphs_to_string(&glyphs);
-        debug!(
-            target: "ui::editbox",
-            "delete_highlighted() text=\"{}\", cursor_pos={}",
-            text, sel_start
-        );
+        t!("delete_highlighted() text='{text}', cursor_pos={sel_start}");
         self.text.set(text);
 
         self.selected.set_null(Role::Internal, 0).unwrap();
@@ -907,7 +906,7 @@ impl EditBox {
     }
 
     async fn handle_touch_start(&self, pos: Point) -> bool {
-        debug!(target: "ui::editbox", "handle_touch_start({pos:?})");
+        t!("handle_touch_start({pos:?})");
         let mut touch_info = self.touch_info.lock().unwrap();
 
         if self.try_handle_drag(&mut touch_info, pos) {
@@ -950,20 +949,20 @@ impl EditBox {
 
             let p1 = Point::new(x1 - scroll, y);
             let p2 = Point::new(x2 - scroll, y);
-            debug!(target: "ui::editbox", "handle center points = ({p1:?}, {p2:?})");
+            t!("handle center points = ({p1:?}, {p2:?})");
 
             const TOUCH_RADIUS_SQ: f32 = 10_000.;
             // Make pos relative to the rect
             let pos_rel = pos - self.rect.get().pos();
 
             if p1.dist_sq(&pos_rel) <= TOUCH_RADIUS_SQ {
-                debug!(target: "ui::editbox", "TouchStateAction::DragSelectHandle [side=-1]");
+                d!("TouchStateAction::DragSelectHandle [side=-1]");
                 // Set touch_state status to enable begin dragging them
                 touch_info.state = TouchStateAction::DragSelectHandle { side: -1 };
                 return true;
             }
             if p2.dist_sq(&pos_rel) <= TOUCH_RADIUS_SQ {
-                debug!(target: "ui::editbox", "TouchStateAction::DragSelectHandle [side=1]");
+                d!("TouchStateAction::DragSelectHandle [side=1]");
                 // Set touch_state status to enable begin dragging them
                 touch_info.state = TouchStateAction::DragSelectHandle { side: 1 };
                 return true;
@@ -974,7 +973,7 @@ impl EditBox {
     }
 
     async fn handle_touch_move(&self, pos: Point) -> bool {
-        //debug!(target: "ui::editbox", "handle_touch_move({pos:?})");
+        t!("handle_touch_move({pos:?})");
         let touch_state = {
             let mut touch_info = self.touch_info.lock().unwrap();
             touch_info.update(&pos);
@@ -986,7 +985,7 @@ impl EditBox {
                 let x = pos.x;
                 self.start_touch_select(x);
                 self.redraw().await;
-                debug!(target: "ui::editbox", "TouchStateAction::Select");
+                d!("TouchStateAction::Select");
                 self.touch_info.lock().unwrap().state = TouchStateAction::Select;
             }
             TouchStateAction::DragSelectHandle { side } => {
@@ -1037,7 +1036,7 @@ impl EditBox {
         true
     }
     async fn handle_touch_end(&self, pos: Point) -> bool {
-        debug!(target: "ui::editbox", "handle_touch_end({pos:?})");
+        t!("handle_touch_end({pos:?})");
         let state = self.touch_info.lock().unwrap().stop();
         match state {
             TouchStateAction::Inactive => return false,
@@ -1165,7 +1164,7 @@ impl EditBox {
 
     async fn redraw(&self) {
         let timest = unixtime();
-        debug!(target: "ui::editbox", "redraw()");
+        t!("redraw()");
 
         let parent_rect = self.parent_rect.lock().unwrap().unwrap().clone();
         self.rect.eval(&parent_rect).expect("unable to eval rect");
@@ -1336,7 +1335,7 @@ impl UIObject for EditBox {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        debug!(target: "ui::editbox", "EditBox::draw()");
+        t!("EditBox::draw()");
         *self.parent_rect.lock().unwrap() = Some(parent_rect);
         self.rect.eval(&parent_rect).ok()?;
 
@@ -1366,7 +1365,7 @@ impl UIObject for EditBox {
             let mut repeater = self.key_repeat.lock().unwrap();
             repeater.key_down(PressedKey::Char(key), repeat)
         };
-        //debug!(target: "ui::editbox", "Key {:?} has {} actions", key, actions);
+        t!("Key {key:?} has {actions} actions");
         for _ in 0..actions {
             self.insert_char(key).await;
         }
@@ -1389,9 +1388,9 @@ impl UIObject for EditBox {
             repeater.key_down(PressedKey::Key(key), repeat)
         };
         // Suppress noisy message
-        /*if actions > 0 {
-            debug!(target: "ui::editbox", "Key {:?} has {} actions", key, actions);
-        }*/
+        if actions > 0 {
+            t!("Key {key:?} has {actions} actions");
+        }
         for _ in 0..actions {
             self.handle_key(&key, &mods).await;
         }
@@ -1414,7 +1413,7 @@ impl UIObject for EditBox {
         // 2. begin selection
         if !rect.contains(mouse_pos) {
             if self.is_focused.get() {
-                debug!(target: "ui::editbox", "EditBox unfocused");
+                d!("EditBox unfocused");
                 self.is_focused.set(false);
                 self.select.lock().unwrap().clear();
 
@@ -1424,9 +1423,9 @@ impl UIObject for EditBox {
         }
 
         if self.is_focused.get() {
-            debug!(target: "ui::editbox", "EditBox clicked");
+            d!("EditBox clicked");
         } else {
-            debug!(target: "ui::editbox", "EditBox focused");
+            d!("EditBox focused");
             self.is_focused.set(true);
         }
 
@@ -1508,14 +1507,13 @@ impl UIObject for EditBox {
     }
 
     async fn handle_mouse_wheel(&self, wheel_pos: Point) -> bool {
-        //debug!(target: "ui::editbox", "rect={rect:?}, wheel_pos={wheel_pos:?}");
         if !self.is_mouse_hover.load(Ordering::Relaxed) {
             return false
         }
 
         let mut scroll = self.scroll.get() + wheel_pos.y * self.scroll_speed.get();
         scroll = scroll.clamp(0., self.max_cursor_scroll());
-        debug!(target: "ui::editbox", "handle_mouse_wheel({wheel_pos:?}) [scroll={scroll}]");
+        t!("handle_mouse_wheel({wheel_pos:?}) [scroll={scroll}]");
         self.scroll.set(scroll);
         self.redraw().await;
 
@@ -1541,7 +1539,7 @@ impl UIObject for EditBox {
     }
 
     async fn handle_compose_text(&self, suggest_text: &str, is_commit: bool) -> bool {
-        debug!(target: "ui::editbox", "handle_compose_text({suggest_text}, {is_commit})");
+        t!("handle_compose_text({suggest_text}, {is_commit})");
 
         if !self.is_active.get() {
             return false
@@ -1559,7 +1557,7 @@ impl UIObject for EditBox {
         true
     }
     async fn handle_set_compose_region(&self, start: usize, end: usize) -> bool {
-        debug!(target: "ui::editbox", "handle_set_compose_region({start}, {end})");
+        t!("handle_set_compose_region({start}, {end})");
 
         if !self.is_active.get() {
             return false

+ 1 - 0
bin/darkwallet/src/ui/emoji_picker/emoji.rs

@@ -1,4 +1,5 @@
 pub static EMOJI_LIST: &[&str] = &[
+    "\u{f0003}",
     "😀",
     "😃",
     "😄",

+ 6 - 5
bin/darkwallet/src/ui/emoji_picker/mod.rs

@@ -47,6 +47,7 @@ use super::{DrawUpdate, OnModify, UIObject};
 mod emoji;
 
 macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::emoji_picker", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::emoji_picker", $($arg)*); } }
 
 pub type EmojiMeshesPtr = Arc<SyncMutex<EmojiMeshes>>;
 
@@ -147,7 +148,7 @@ impl EmojiPicker {
         emoji_meshes: EmojiMeshesPtr,
         ex: ExecutorPtr,
     ) -> Pimpl {
-        d!("EmojiPicker::new()");
+        t!("EmojiPicker::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let rect = PropertyRect::wrap(node_ref, Role::Internal, "rect").unwrap();
@@ -241,7 +242,7 @@ impl EmojiPicker {
             let node = self.node.upgrade().unwrap();
             node.trigger("emoji_select", param_data).await.unwrap();
         } else {
-            d!("Index out of bounds");
+            d!("Index out of bounds: {idx}");
         }
     }
 
@@ -254,7 +255,7 @@ impl EmojiPicker {
             return;
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
-        d!("replace draw calls done");
+        t!("replace draw calls done");
     }
 
     fn get_draw_calls(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
@@ -334,7 +335,7 @@ impl UIObject for EmojiPicker {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        d!("EmojiPicker::draw()");
+        t!("EmojiPicker::draw()");
         *self.parent_rect.lock().unwrap() = Some(parent_rect);
         self.get_draw_calls(parent_rect)
     }
@@ -349,7 +350,7 @@ impl UIObject for EmojiPicker {
         if !self.is_mouse_hover.load(Ordering::Relaxed) {
             return false
         }
-        d!("handle_mouse_wheel()");
+        t!("handle_mouse_wheel()");
 
         let mut scroll = self.scroll.get();
         scroll -= self.mouse_scroll_speed.get() * wheel_pos.y;

+ 6 - 3
bin/darkwallet/src/ui/image.rs

@@ -38,6 +38,9 @@ use crate::{
 
 use super::{DrawUpdate, OnModify, UIObject};
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::image", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::image", $($arg)*); } }
+
 pub type ImagePtr = Arc<Image>;
 
 pub struct Image {
@@ -59,7 +62,7 @@ pub struct Image {
 
 impl Image {
     pub async fn new(node: SceneNodeWeak, render_api: RenderApi, ex: ExecutorPtr) -> Pimpl {
-        debug!(target: "ui::image", "Image::new()");
+        t!("Image::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let rect = PropertyRect::wrap(node_ref, Role::Internal, "rect").unwrap();
@@ -136,7 +139,7 @@ impl Image {
             return;
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
-        debug!(target: "ui::image", "replace draw calls done");
+        t!("replace draw calls done");
     }
 
     /// Called whenever any property changes.
@@ -204,7 +207,7 @@ impl UIObject for Image {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        debug!(target: "ui::image", "Image::draw()");
+        t!("Image::draw()");
         *self.parent_rect.lock().unwrap() = Some(parent_rect);
         self.get_draw_calls(parent_rect).await
     }

+ 15 - 26
bin/darkwallet/src/ui/layer.rs

@@ -35,7 +35,8 @@ use super::{
     get_children_ordered, get_ui_object3, get_ui_object_ptr, DrawUpdate, OnModify, UIObject,
 };
 
-pub const DEBUG_LAYER: bool = false;
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::layer", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::layer", $($arg)*); } }
 
 pub type LayerPtr = Arc<Layer>;
 
@@ -56,7 +57,7 @@ pub struct Layer {
 impl Layer {
     pub async fn new(node: SceneNodeWeak, render_api: RenderApi, ex: ExecutorPtr) -> Pimpl {
         let node_ref = &node.upgrade().unwrap();
-        debug!(target: "ui::layer", "Layer::new({node_ref:?})");
+        t!("Layer::new({node_ref:?})");
         let is_visible = PropertyBool::wrap(node_ref, Role::Internal, "is_visible", 0).unwrap();
         let rect = PropertyRect::wrap(node_ref, Role::Internal, "rect").unwrap();
         let z_index = PropertyUint32::wrap(node_ref, Role::Internal, "z_index", 0).unwrap();
@@ -89,7 +90,7 @@ impl Layer {
 
     async fn redraw(self: Arc<Self>) {
         let timest = unixtime();
-        debug!(target: "ui::layer", "Layer::redraw({:?})", self.node.upgrade().unwrap());
+        t!("Layer::redraw({:?})", self.node.upgrade().unwrap());
         let Some(parent_rect) = self.parent_rect.lock().unwrap().clone() else { return };
 
         let Some(draw_update) = self.get_draw_calls(parent_rect).await else {
@@ -97,13 +98,13 @@ impl Layer {
             return;
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
-        debug!(target: "ui::layer", "Layer::redraw({:?}) DONE [timest={timest}]", self.node.upgrade().unwrap());
+        t!("Layer::redraw({:?}) DONE [timest={timest}]", self.node.upgrade().unwrap());
     }
 
     async fn get_draw_calls(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
         self.rect.eval(&parent_rect).ok()?;
         let rect = self.rect.get();
-        debug!(target: "ui::layer", "Layer::get_draw_calls() [rect={rect:?}, dc={}]", self.dc_key);
+        t!("Layer::get_draw_calls() [rect={rect:?}, dc={}]", self.dc_key);
 
         // Apply viewport
 
@@ -116,7 +117,7 @@ impl Layer {
             for child in self.get_children() {
                 let obj = get_ui_object3(&child);
                 let Some(mut draw_update) = obj.draw(rect).await else {
-                    debug!(target: "ui::layer", "Skipped draw for {child:?}");
+                    t!("Skipped draw for {child:?}");
                     continue
                 };
 
@@ -162,7 +163,7 @@ impl UIObject for Layer {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        debug!(target: "ui::layer", "Layer::draw({:?})", self.node.upgrade().unwrap());
+        t!("Layer::draw({:?})", self.node.upgrade().unwrap());
         *self.parent_rect.lock().unwrap() = Some(parent_rect);
 
         /*
@@ -177,7 +178,7 @@ impl UIObject for Layer {
         */
 
         let update = self.get_draw_calls(parent_rect).await;
-        debug!(target: "ui::layer", "Layer::draw({:?}) DONE", self.node.upgrade().unwrap());
+        t!("Layer::draw({:?}) DONE", self.node.upgrade().unwrap());
         update
     }
 
@@ -188,9 +189,7 @@ impl UIObject for Layer {
         for child in self.get_children() {
             let obj = get_ui_object3(&child);
             if obj.handle_char(key, mods, repeat).await {
-                if DEBUG_LAYER {
-                    debug!(target: "layer", "handle_char({key:?}, {mods:?}, {repeat}) swallowed by {child:?}");
-                }
+                t!("handle_char({key:?}, {mods:?}, {repeat}) swallowed by {child:?}");
                 return true
             }
         }
@@ -204,9 +203,7 @@ impl UIObject for Layer {
         for child in self.get_children() {
             let obj = get_ui_object3(&child);
             if obj.handle_key_down(key, mods, repeat).await {
-                if DEBUG_LAYER {
-                    debug!(target: "layer", "handle_key_down({key:?}, {mods:?}, {repeat}) swallowed by {child:?}");
-                }
+                t!("handle_key_down({key:?}, {mods:?}, {repeat}) swallowed by {child:?}");
                 return true
             }
         }
@@ -220,9 +217,7 @@ impl UIObject for Layer {
         for child in self.get_children() {
             let obj = get_ui_object3(&child);
             if obj.handle_key_up(key, mods).await {
-                if DEBUG_LAYER {
-                    debug!(target: "layer", "handle_key_up({key:?}, {mods:?}) swallowed by {child:?}");
-                }
+                t!("handle_key_up({key:?}, {mods:?}) swallowed by {child:?}");
                 return true
             }
         }
@@ -236,9 +231,7 @@ impl UIObject for Layer {
         for child in self.get_children() {
             let obj = get_ui_object3(&child);
             if obj.handle_mouse_btn_down(btn, mouse_pos).await {
-                if DEBUG_LAYER {
-                    debug!(target: "layer", "handle_mouse_btn_down({btn:?}, {mouse_pos:?}) swallowed by {child:?}");
-                }
+                t!("handle_mouse_btn_down({btn:?}, {mouse_pos:?}) swallowed by {child:?}");
                 return true
             }
         }
@@ -252,9 +245,7 @@ impl UIObject for Layer {
         for child in self.get_children() {
             let obj = get_ui_object3(&child);
             if obj.handle_mouse_btn_up(btn, mouse_pos).await {
-                if DEBUG_LAYER {
-                    debug!(target: "layer", "handle_mouse_btn_up({btn:?}, {mouse_pos:?}) swallowed by {child:?}");
-                }
+                t!("handle_mouse_btn_up({btn:?}, {mouse_pos:?}) swallowed by {child:?}");
                 return true
             }
         }
@@ -268,9 +259,7 @@ impl UIObject for Layer {
         for child in self.get_children() {
             let obj = get_ui_object3(&child);
             if obj.handle_mouse_move(mouse_pos).await {
-                if DEBUG_LAYER {
-                    debug!(target: "layer", "handle_mouse_move({mouse_pos:?}) swallowed by {child:?}");
-                }
+                t!("handle_mouse_move({mouse_pos:?}) swallowed by {child:?}");
                 return true
             }
         }

+ 1 - 1
bin/darkwallet/src/ui/mod.rs

@@ -161,7 +161,7 @@ impl<T: Send + Sync + 'static> OnModify<T> {
                     }
                 }
 
-                debug!(target: "app", "Property '{}':{}/'{}' modified", node_name, node_id, prop_name);
+                trace!(target: "app", "Property '{}':{}/'{}' modified", node_name, node_id, prop_name);
 
                 let Some(self_) = me.upgrade() else {
                     // Should not happen

+ 6 - 1
bin/darkwallet/src/ui/shortcut.rs

@@ -30,6 +30,9 @@ use crate::{
 
 use super::UIObject;
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::shortcut", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::shortcut", $($arg)*); } }
+
 fn vec_to_string(v: Vec<&str>) -> Vec<String> {
     v.into_iter().map(|s| s.to_string()).collect()
 }
@@ -44,7 +47,7 @@ pub struct Shortcut {
 
 impl Shortcut {
     pub async fn new(node: SceneNodeWeak) -> Pimpl {
-        debug!(target: "ui::button", "Button::new()");
+        t!("Shortcut::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let key = node_ref.get_property("key").unwrap();
@@ -69,6 +72,7 @@ impl UIObject for Shortcut {
     }
 
     async fn handle_key_down(&self, key: KeyCode, mods: KeyMods, repeat: bool) -> bool {
+        t!("handle_key_down({key:?}, {mods:?}, {repeat})");
         if repeat {
             return false
         }
@@ -84,6 +88,7 @@ impl UIObject for Shortcut {
         }
 
         let node = self.node.upgrade().unwrap();
+        d!("Shortcut invoked: {node:?}");
         node.trigger("shortcut", vec![]).await.unwrap();
 
         true

+ 8 - 5
bin/darkwallet/src/ui/text.rs

@@ -38,6 +38,9 @@ use crate::{
 
 use super::{DrawUpdate, OnModify, UIObject};
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::text", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::text", $($arg)*); } }
+
 pub type TextPtr = Arc<Text>;
 
 #[derive(Clone)]
@@ -75,7 +78,7 @@ impl Text {
         text_shaper: TextShaperPtr,
         ex: ExecutorPtr,
     ) -> Pimpl {
-        debug!(target: "ui::text", "Text::new()");
+        t!("Text::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let rect = PropertyRect::wrap(node_ref, Role::Internal, "rect").unwrap();
@@ -121,7 +124,7 @@ impl Text {
         let debug = self.debug.get();
         let window_scale = self.window_scale.get();
 
-        debug!(target: "ui::text", "Rendering label '{}'", text);
+        t!("Rendering label '{}'", text);
         let glyphs = self.text_shaper.shape(text, font_size, window_scale);
         let atlas = text::make_texture_atlas(&self.render_api, &glyphs);
 
@@ -155,7 +158,7 @@ impl Text {
 
     async fn redraw(self: Arc<Self>) {
         let timest = unixtime();
-        debug!(target: "ui::text", "Text::redraw({:?})", self.node.upgrade().unwrap());
+        t!("Text::redraw({:?})", self.node.upgrade().unwrap());
         let Some(parent_rect) = self.parent_rect.lock().unwrap().clone() else { return };
 
         let Some(draw_update) = self.get_draw_calls(parent_rect).await else {
@@ -163,7 +166,7 @@ impl Text {
             return;
         };
         self.render_api.replace_draw_calls(timest, draw_update.draw_calls);
-        debug!(target: "ui::text", "replace draw calls done");
+        t!("replace draw calls done");
     }
 
     async fn get_draw_calls(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
@@ -222,7 +225,7 @@ impl UIObject for Text {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        debug!(target: "ui::text", "Text::draw({:?})", self.node.upgrade().unwrap());
+        t!("Text::draw({:?})", self.node.upgrade().unwrap());
         *self.parent_rect.lock().unwrap() = Some(parent_rect);
         self.get_draw_calls(parent_rect).await
     }

+ 7 - 4
bin/darkwallet/src/ui/vector_art/mod.rs

@@ -38,6 +38,9 @@ use super::{DrawUpdate, OnModify, UIObject};
 pub mod shape;
 use shape::VectorShape;
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::vector_art", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::vector_art", $($arg)*); } }
+
 pub type VectorArtPtr = Arc<VectorArt>;
 
 pub struct VectorArt {
@@ -63,7 +66,7 @@ impl VectorArt {
         render_api: RenderApi,
         ex: ExecutorPtr,
     ) -> Pimpl {
-        debug!(target: "ui::vector_art", "VectorArt::new()");
+        t!("VectorArt::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let is_visible = PropertyBool::wrap(node_ref, Role::Internal, "is_visible", 0).unwrap();
@@ -99,7 +102,7 @@ impl VectorArt {
 
     async fn redraw(self: Arc<Self>) {
         let timest = unixtime();
-        debug!(target: "ui::vector_art", "VectorArt::redraw({})", self.node_path());
+        trace!(target: "ui::vector_art", "VectorArt::redraw({})", self.node_path());
         let Some(parent_rect) = self.parent_rect.lock().unwrap().clone() else { return };
 
         let Some(draw_update) = self.get_draw_calls(parent_rect).await else {
@@ -111,7 +114,7 @@ impl VectorArt {
 
     fn get_draw_instrs(&self) -> Vec<GfxDrawInstruction> {
         if !self.is_visible.get() {
-            debug!(target: "ui::vector_art", "Skipping draw for invisible {}", self.node_path());
+            t!("Skipping draw for invisible {}", self.node_path());
             return vec![]
         }
 
@@ -169,7 +172,7 @@ impl UIObject for VectorArt {
     }
 
     async fn draw(&self, parent_rect: Rectangle) -> Option<DrawUpdate> {
-        debug!(target: "ui::vector_art", "VectorArt::draw({})", self.node_path());
+        t!("VectorArt::draw({})", self.node_path());
         *self.parent_rect.lock().unwrap() = Some(parent_rect);
         self.get_draw_calls(parent_rect).await
     }

+ 18 - 15
bin/darkwallet/src/ui/win.rs

@@ -32,6 +32,9 @@ use crate::{
 
 use super::{get_children_ordered, get_ui_object3, get_ui_object_ptr, OnModify};
 
+macro_rules! d { ($($arg:tt)*) => { debug!(target: "ui::window", $($arg)*); } }
+macro_rules! t { ($($arg:tt)*) => { trace!(target: "ui::window", $($arg)*); } }
+
 #[cfg(feature = "emulate-android")]
 const EMULATE_TOUCH: bool = true;
 
@@ -51,7 +54,7 @@ pub struct Window {
 
 impl Window {
     pub async fn new(node: SceneNodeWeak, render_api: RenderApi) -> Pimpl {
-        debug!(target: "ui::win", "Window::new()");
+        t!("Window::new()");
 
         let node_ref = &node.upgrade().unwrap();
         let screen_size = PropertyDimension::wrap(node_ref, Role::Internal, "screen_size").unwrap();
@@ -77,11 +80,11 @@ impl Window {
         let resize_task = ex.spawn(async move {
             loop {
                 let Ok(size) = ev_sub.receive().await else {
-                    debug!(target: "ui::win", "Event relayer closed");
+                    t!("Event relayer closed");
                     break
                 };
 
-                debug!(target: "ui::win", "Window resized {size:?}");
+                d!("Window resized {size:?}");
                 // Now update the properties
                 screen_size2.set(size);
 
@@ -161,7 +164,7 @@ impl Window {
             let autosuggest_task = ex.spawn(async move {
                 loop {
                     let Ok(ev) = recvr.recv().await else {
-                        debug!(target: "ui::win", "Event relayer closed");
+                        t!("Event relayer closed");
                         break
                     };
 
@@ -186,7 +189,7 @@ impl Window {
 
     async fn process_char(me: &Weak<Self>, ev_sub: &Subscription<(char, KeyMods, bool)>) -> bool {
         let Ok((key, mods, repeat)) = ev_sub.receive().await else {
-            debug!(target: "ui::win", "Event relayer closed");
+            t!("Event relayer closed");
             return false
         };
 
@@ -204,7 +207,7 @@ impl Window {
         ev_sub: &Subscription<(KeyCode, KeyMods, bool)>,
     ) -> bool {
         let Ok((key, mods, repeat)) = ev_sub.receive().await else {
-            debug!(target: "ui::win", "Event relayer closed");
+            t!("Event relayer closed");
             return false
         };
 
@@ -219,7 +222,7 @@ impl Window {
 
     async fn process_key_up(me: &Weak<Self>, ev_sub: &Subscription<(KeyCode, KeyMods)>) -> bool {
         let Ok((key, mods)) = ev_sub.receive().await else {
-            debug!(target: "ui::win", "Event relayer closed");
+            t!("Event relayer closed");
             return false
         };
 
@@ -237,7 +240,7 @@ impl Window {
         ev_sub: &Subscription<(MouseButton, Point)>,
     ) -> bool {
         let Ok((btn, mouse_pos)) = ev_sub.receive().await else {
-            debug!(target: "ui::editbox", "Event relayer closed");
+            t!("Event relayer closed");
             return false
         };
 
@@ -255,7 +258,7 @@ impl Window {
         ev_sub: &Subscription<(MouseButton, Point)>,
     ) -> bool {
         let Ok((btn, mouse_pos)) = ev_sub.receive().await else {
-            debug!(target: "ui::editbox", "Event relayer closed");
+            t!("Event relayer closed");
             return false
         };
 
@@ -270,7 +273,7 @@ impl Window {
 
     async fn process_mouse_move(me: &Weak<Self>, ev_sub: &Subscription<Point>) -> bool {
         let Ok(mouse_pos) = ev_sub.receive().await else {
-            debug!(target: "ui::editbox", "Event relayer closed");
+            t!("Event relayer closed");
             return false
         };
 
@@ -285,7 +288,7 @@ impl Window {
 
     async fn process_mouse_wheel(me: &Weak<Self>, ev_sub: &Subscription<Point>) -> bool {
         let Ok(wheel_pos) = ev_sub.receive().await else {
-            debug!(target: "ui::chatview", "Event relayer closed");
+            t!("Event relayer closed");
             return false
         };
 
@@ -303,7 +306,7 @@ impl Window {
         ev_sub: &Subscription<(TouchPhase, u64, Point)>,
     ) -> bool {
         let Ok((phase, id, touch_pos)) = ev_sub.receive().await else {
-            debug!(target: "ui::editbox", "Event relayer closed");
+            t!("Event relayer closed");
             return false
         };
 
@@ -444,7 +447,7 @@ impl Window {
 
         let local = self.screen_size.get() / self.scale.get();
         let rect = Rectangle::from([0., 0., local.w, local.h]);
-        debug!(target: "ui::win", "Window::draw({rect:?})");
+        t!("Window::draw({rect:?})");
 
         let mut draw_calls = vec![];
         let mut child_calls = vec![];
@@ -466,10 +469,10 @@ impl Window {
             z_index: 0,
         };
         draw_calls.push((0, dc));
-        //debug!(target: "ui::win", "  => {:?}", draw_calls);
+        //t!("  => {:?}", draw_calls);
 
         self.render_api.replace_draw_calls(timest, draw_calls);
 
-        debug!(target: "ui::win", "Window::draw() - replaced draw call [timest={timest}]");
+        t!("Window::draw() - replaced draw call [timest={timest}]");
     }
 }