From 0dc59cea16e057c60989a0ab1faea605fadb90f8 Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 20 Feb 2024 20:42:17 +0100 Subject: [PATCH] add tracing logs --- src/paragraph/mod.rs | 2 +- src/paragraph/parser/abschnitt.rs | 3 +++ src/paragraph/parser/liste.rs | 2 ++ src/paragraph/parser/mod.rs | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/paragraph/mod.rs b/src/paragraph/mod.rs index bd17e7e..1d39de3 100644 --- a/src/paragraph/mod.rs +++ b/src/paragraph/mod.rs @@ -25,7 +25,7 @@ use std::{ path::Path, }; -use log::info; +use log::{info}; use crate::{ law::LawBuilder, diff --git a/src/paragraph/parser/abschnitt.rs b/src/paragraph/parser/abschnitt.rs index aae4f66..3bdc740 100644 --- a/src/paragraph/parser/abschnitt.rs +++ b/src/paragraph/parser/abschnitt.rs @@ -17,6 +17,7 @@ use std::collections::HashMap; use std::iter::Peekable; +use log::trace; use roxmltree::{Children, Node}; use crate::law::LawBuilder; @@ -102,6 +103,7 @@ impl Abschnitt { // We are done with meta-data parsing if key == "Text" { + trace!("Done parsing metadata, got 'Text'"); break; } @@ -125,6 +127,7 @@ impl Abschnitt { builder.add_next_para_note(value.clone()); } + trace!("Parsed metadata: key='{key}', value='{value}'"); self.metadata.insert(key, value); } } diff --git a/src/paragraph/parser/liste.rs b/src/paragraph/parser/liste.rs index f61ea95..86e2c30 100644 --- a/src/paragraph/parser/liste.rs +++ b/src/paragraph/parser/liste.rs @@ -16,6 +16,7 @@ use std::iter::Peekable; +use log::trace; use roxmltree::{Children, Node}; use crate::{ @@ -33,6 +34,7 @@ impl Liste { } pub(crate) fn parse_full(n: &mut Peekable) -> Self { + trace!("Parsing liste..."); Expect::from(n.peek().unwrap()).tag("liste"); let mut content = Vec::new(); diff --git a/src/paragraph/parser/mod.rs b/src/paragraph/parser/mod.rs index daed3fb..4bfb830 100644 --- a/src/paragraph/parser/mod.rs +++ b/src/paragraph/parser/mod.rs @@ -77,6 +77,7 @@ impl Risdok { pub(crate) fn from_str(xml: &str, builder: &mut LawBuilder) -> Result { let doc = roxmltree::Document::parse(xml)?; + trace!("{doc:?}"); let root = doc.root(); assert_eq!(root.children().count(), 1); Ok(Self::parse(root.children().next().unwrap(), builder)) @@ -171,6 +172,7 @@ impl Ziffernliste { } pub(crate) fn parse(c: &mut Peekable) -> Self { + trace!("Parsing Ziffernliste..."); let n = c.next().unwrap(); assert!(Self::test(&n));