Make the tracing macros optional.

This commit is contained in:
Tom Alexander
2023-08-10 20:04:59 -04:00
parent 1f10d3d064
commit cd1b4ba785
44 changed files with 250 additions and 228 deletions

View File

@@ -22,7 +22,7 @@ use crate::parser::util::exit_matcher_parser;
use crate::parser::util::start_of_line;
use crate::parser::LatexEnvironment;
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn latex_environment<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -51,12 +51,15 @@ pub fn latex_environment<'r, 's>(
Ok((remaining, LatexEnvironment { source }))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn name<'s>(input: &'s str) -> Res<&'s str, &'s str> {
take_while1(|c: char| c.is_alphanumeric() || c == '*')(input)
}
#[tracing::instrument(ret, level = "debug", skip(end_matcher))]
#[cfg_attr(
feature = "tracing",
tracing::instrument(ret, level = "debug", skip(end_matcher))
)]
pub fn contents<'r, 's, F: Fn(Context<'r, 's>, &'s str) -> Res<&'s str, &'s str>>(
end_matcher: F,
context: Context<'r, 's>,
@@ -82,7 +85,7 @@ fn latex_environment_end(
}
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn _latex_environment_end<'r, 's, 'x>(
context: Context<'r, 's>,
input: &'s str,