From bc2d662af7fd9b527dc6b49f31627780e58d79c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 31 Jan 2025 20:42:53 +0100 Subject: [PATCH] Replace `println` with `log` calls in `markdown` module --- Cargo.lock | 1 + widget/Cargo.toml | 1 + widget/src/markdown.rs | 10 +++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0ad8c0b354..409494238f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2640,6 +2640,7 @@ dependencies = [ "iced_highlighter", "iced_renderer", "iced_runtime", + "log", "num-traits", "ouroboros", "pulldown-cmark", diff --git a/widget/Cargo.toml b/widget/Cargo.toml index e19cad0843..6d1f054e56 100644 --- a/widget/Cargo.toml +++ b/widget/Cargo.toml @@ -33,6 +33,7 @@ iced_renderer.workspace = true iced_runtime.workspace = true num-traits.workspace = true +log.workspace = true rustc-hash.workspace = true thiserror.workspace = true unicode-segmentation.workspace = true diff --git a/widget/src/markdown.rs b/widget/src/markdown.rs index 7f6965e59c..77a560ecb1 100644 --- a/widget/src/markdown.rs +++ b/widget/src/markdown.rs @@ -313,18 +313,22 @@ impl Highlighter { Some(line) if line.0 == text => {} _ => { if self.current + 1 < self.lines.len() { - println!("Resetting..."); + log::debug!("Resetting highlighter..."); self.parser.reset(); self.lines.truncate(self.current); for line in &self.lines { - println!("Refeeding {n} lines", n = self.lines.len()); + log::debug!( + "Refeeding {n} lines", + n = self.lines.len() + ); let _ = self.parser.highlight_line(&line.0); } } - println!("Parsing: {text}", text = text.trim_end()); + log::trace!("Parsing: {text}", text = text.trim_end()); + if self.current + 1 < self.lines.len() { self.parser.commit(); }