aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-05 11:56:56 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-05 11:56:56 +0200
commit44c3f10befb3f728898017b9ba9a6bc4161af799 (patch)
treeab35804f4a3f716acfee29f31d1b96d1ae1ecf41
parent6fd5d61ed9b8cb66c13f44893d50025c9a87b217 (diff)
downloadmarkdown-rs-44c3f10befb3f728898017b9ba9a6bc4161af799.tar.gz
markdown-rs-44c3f10befb3f728898017b9ba9a6bc4161af799.tar.bz2
markdown-rs-44c3f10befb3f728898017b9ba9a6bc4161af799.zip
Fix to improve debug logging
Diffstat (limited to '')
-rw-r--r--src/tokenizer.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 0ab8784..8843e47 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -13,7 +13,14 @@ use crate::parser::ParseState;
use crate::resolve::{call as call_resolve, Name as ResolveName};
use crate::state::{call, State};
use crate::util::{constant::TAB_SIZE, edit_map::EditMap};
-use alloc::{boxed::Box, string::String, vec, vec::Vec};
+use alloc::{
+ boxed::Box,
+ format,
+ string::{String, ToString},
+ vec,
+ vec::Vec,
+};
+use core::str;
/// Containers.
///
@@ -714,7 +721,14 @@ fn push_impl(
None
};
- log::debug!("feed: `{:?}` to {:?}", byte, name);
+ let visible = byte.map(|d| {
+ if (b' '..=b'~').contains(&d) {
+ str::from_utf8(&[d]).unwrap().to_string()
+ } else {
+ format!("0x{:x}", d)
+ }
+ });
+ log::debug!("feed: `{:?}` to {:?}", visible, name);
tokenizer.expect(byte);
state = call(tokenizer, name);
};