Add some trace logging for event processing

This adds some trace logging to help debug markdown parsing and HTML
parsing.
This commit is contained in:
Eric Huss 2025-10-29 20:34:11 -07:00
parent eaa778bebd
commit 8ba833feb2

View file

@ -19,7 +19,7 @@ use pulldown_cmark::{Alignment, CodeBlockKind, CowStr, Event, LinkType, Tag, Tag
use std::borrow::Cow; use std::borrow::Cow;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::ops::Deref; use std::ops::Deref;
use tracing::{error, warn}; use tracing::{error, trace, warn};
/// Helper to create a [`QualName`]. /// Helper to create a [`QualName`].
macro_rules! attr_qual_name { macro_rules! attr_qual_name {
@ -300,6 +300,7 @@ where
/// The main processing loop. Processes all events until the end. /// The main processing loop. Processes all events until the end.
fn process_events(&mut self) { fn process_events(&mut self) {
while let Some(event) = self.events.next() { while let Some(event) = self.events.next() {
trace!("event={event:?}");
match event { match event {
Event::Start(tag) => self.start_tag(tag), Event::Start(tag) => self.start_tag(tag),
Event::End(tag) => { Event::End(tag) => {
@ -599,6 +600,7 @@ where
let tokens = parse_html(&html); let tokens = parse_html(&html);
let mut is_raw = false; let mut is_raw = false;
for token in tokens { for token in tokens {
trace!("html token={token:?}");
match token { match token {
Token::DoctypeToken(_) => {} Token::DoctypeToken(_) => {}
Token::TagToken(tag) => { Token::TagToken(tag) => {