1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#[cfg(feature = "html_trace_bt")]
extern crate backtrace;

/* This is to work around a false positive for the clippy warning
 * `match_on_same_arms`.
 * See https://github.com/Manishearth/rust-clippy/issues/1390
 */
#[cfg(not(feature = "html_trace"))]
#[inline(always)]
pub fn nop() {}

#[cfg(feature = "html_trace")]
#[macro_export]
#[doc(hidden)]
macro_rules! html_trace {
    ($fmt:expr) => {
         #[cfg(feature = "html_trace_bt")]
         {
             let bt = ::backtrace::Backtrace::new();
             log::info!( concat!($fmt, " at {:?}"), bt );
         }
         #[cfg(not(feature = "html_trace_bt"))]
         {
             log::info!($fmt);
         }
    };
    ($fmt:expr, $( $args:expr ),*) => {
         #[cfg(feature = "html_trace_bt")]
         {
             let bt = ::backtrace::Backtrace::new();
             log::info!( concat!($fmt, " at {:?}"), $( $args ),* , bt );
         }
         #[cfg(not(feature = "html_trace_bt"))]
         {
             log::info!($fmt, $( $args ),*);
         }
    };
}
#[cfg(not(feature = "html_trace"))]
#[macro_export]
#[doc(hidden)]
macro_rules! html_trace {
    ($fmt:expr) => {
        $crate::macros::nop();
    };
    ($fmt:expr, $( $args:expr ),*) => {
        $crate::macros::nop();
    };
}

#[cfg(feature = "html_trace")]
#[macro_export]
#[doc(hidden)]
macro_rules! html_trace_quiet {
    ($fmt:expr) => {
         log::trace!( $fmt );
    };
    ($fmt:expr, $( $args:expr ),*) => {
         log::trace!( $fmt, $( $args ),* );
    };
}

#[cfg(not(feature = "html_trace"))]
#[macro_export]
#[doc(hidden)]
macro_rules! html_trace_quiet {
    ($fmt:expr) => {
        $crate::macros::nop();
    };
    ($fmt:expr, $( $args:expr ),*) => {
        $crate::macros::nop();
    };
}