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

@@ -19,7 +19,7 @@ use crate::parser::parser_context::ContextElement;
use crate::parser::parser_context::ExitMatcherNode;
use crate::parser::util::exit_matcher_parser;
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn regular_link<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -30,7 +30,7 @@ pub fn regular_link<'r, 's>(
))(input)
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn regular_link_without_description<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -43,7 +43,7 @@ pub fn regular_link_without_description<'r, 's>(
Ok((remaining, RegularLink { source }))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn regular_link_with_description<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -58,7 +58,7 @@ pub fn regular_link_with_description<'r, 's>(
Ok((remaining, RegularLink { source }))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn pathreg<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
let (remaining, path) = escaped(
take_till1(|c| match c {
@@ -71,7 +71,7 @@ pub fn pathreg<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str,
Ok((remaining, path))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn description<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -92,7 +92,7 @@ pub fn description<'r, 's>(
Ok((remaining, children))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn description_end<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
tag("]]")(input)
}