Skip to content

Commit adf4485

Browse files
authored
Auto merge of #466 - alsuren:trace, r=jdm
use trace!() in tokenizer, to reduce log spam html5ever doesn't currently use trace!() anywhere. This patch downgrades a few of the noisiest debug!() calls to use trace!() instead. This seems like a more reasonable log level for a tokenizer. This makes configuring env_logger to debug other code easier (RUST_LOG=debug rather than RUST_LOG=html5ever=info,debug), and makes working with minimal wasm log frameworks like console_log nicer (the console_log crate doesn't have a way to set different levels for different log prefixes). There is a single debug statement in html5ever/src/tokenizer/mod.rs that I've not changed: debug!("processing EOF in state {:?}", self.state); I didn't change this to trace, because I notice this log line anywhere in my logs. If you want me to change this too, then I can. I'm also happy to close this PR, if you think it's not appropriate.
2 parents af0f510 + 3cf2fb1 commit adf4485

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

html5ever/src/tokenizer/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use self::char_ref::{CharRef, CharRefTokenizer};
2323

2424
use crate::util::str::lower_ascii_letter;
2525

26-
use log::debug;
26+
use log::{debug, trace};
2727
use mac::{_tt_as_expr_hack, format_if, matches};
2828
use markup5ever::{namespace_url, ns, small_char_set};
2929
use std::borrow::Cow::{self, Borrowed};
@@ -276,7 +276,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
276276
self.emit_error(Cow::Owned(msg));
277277
}
278278

279-
debug!("got character {}", c);
279+
trace!("got character {}", c);
280280
self.current_char = c;
281281
Some(c)
282282
}
@@ -304,7 +304,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
304304
}
305305

306306
let d = input.pop_except_from(set);
307-
debug!("got characters {:?}", d);
307+
trace!("got characters {:?}", d);
308308
match d {
309309
Some(FromSet(c)) => self.get_preprocessed_char(c, input).map(FromSet),
310310

@@ -605,7 +605,7 @@ macro_rules! shorthand (
605605
// so it's behind a cfg flag.
606606
#[cfg(trace_tokenizer)]
607607
macro_rules! sh_trace ( ( $me:ident : $($cmds:tt)* ) => ({
608-
debug!(" {:s}", stringify!($($cmds)*));
608+
trace!(" {:s}", stringify!($($cmds)*));
609609
shorthand!($me:expr : $($cmds)*);
610610
}));
611611

@@ -689,7 +689,7 @@ impl<Sink: TokenSink> Tokenizer<Sink> {
689689
return self.step_char_ref_tokenizer(input);
690690
}
691691

692-
debug!("processing in state {:?}", self.state);
692+
trace!("processing in state {:?}", self.state);
693693
match self.state {
694694
//§ data-state
695695
states::Data => loop {

0 commit comments

Comments
 (0)