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

@@ -31,7 +31,7 @@ use crate::parser::util::get_consumed;
use crate::parser::util::start_of_line;
use crate::parser::util::text_until_exit;
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn verse_block<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -80,7 +80,7 @@ pub fn verse_block<'r, 's>(
))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn comment_block<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -116,7 +116,7 @@ pub fn comment_block<'r, 's>(
))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn example_block<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -152,7 +152,7 @@ pub fn example_block<'r, 's>(
))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn export_block<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
@@ -189,7 +189,7 @@ pub fn export_block<'r, 's>(
))
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
pub fn src_block<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, SrcBlock<'s>> {
let (remaining, name) = lesser_block_begin("src")(context, input)?;
// https://orgmode.org/worg/org-syntax.html#Blocks claims that data is mandatory and must follow the LANGUAGE SWITCHES ARGUMENTS pattern but testing has shown that no data and incorrect data here will still parse to a src block.
@@ -223,12 +223,12 @@ pub fn src_block<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s st
))
}
#[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> {
is_not(" \t\r\n")(input)
}
#[tracing::instrument(ret, level = "debug")]
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn data<'s>(input: &'s str) -> Res<&'s str, &'s str> {
is_not("\r\n")(input)
}