Skip to main content

turtle_build/run/
log.rs

1macro_rules! debug {
2    ($context:expr, $console:expr, $template:literal, $($value:expr),+) => {
3        if $context.options().debug {
4            $crate::run::log::log!($console, $template, $($value),+);
5        }
6    };
7}
8
9macro_rules! profile {
10    ($context:expr, $console:expr, $template:literal, $($value:expr),+) => {
11        if $context.options().profile {
12            $crate::run::log::log!($console, $template, $($value),+);
13        }
14    };
15}
16
17macro_rules! log {
18    ($console:expr, $template:literal, $($value:expr),+) => {
19        $console.write_stderr(
20            ("turtle: ".to_owned() + &format!($template, $($value),+)).as_bytes(),
21        ).await?;
22        $console.write_stderr("\n".as_bytes()).await?;
23    };
24}
25
26pub(crate) use {debug, log, profile};