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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#[macro_export]
macro_rules! spanned {
($name:expr, $code:block) => {{
use tracing::debug_span;
let _entered_span = debug_span!($name).entered();
$code
}};
($name:expr, || $code:block) => {{
use tracing::debug_span;
let _entered_span = debug_span!($name).entered();
(|| $code)()
}};
}
#[macro_export]
macro_rules! tagged_event {
($level:ident, $event_tag:path, $($arg:tt)*) => {{
use tracing;
fn assert_eventtag(_: &EventTag) {}
assert_eventtag(&$event_tag);
let event_tag_id: u64 = $event_tag.into();
tracing::event!(tracing::Level::$level, event_tag_id, $($arg)*)
}}
}
#[macro_export]
macro_rules! admin_debug {
($($arg:tt)*) => { tagged_event!(DEBUG, EventTag::AdminDebug, $($arg)*) }
}
#[macro_export]
macro_rules! admin_error {
($($arg:tt)*) => { tagged_event!(ERROR, EventTag::AdminError, $($arg)*) }
}
#[macro_export]
macro_rules! admin_warn {
($($arg:tt)*) => { tagged_event!(WARN, EventTag::AdminWarn, $($arg)*) }
}
#[macro_export]
macro_rules! admin_info {
($($arg:tt)*) => { tagged_event!(INFO, EventTag::AdminInfo, $($arg)*) }
}
#[macro_export]
macro_rules! request_error {
($($arg:tt)*) => { tagged_event!(ERROR, EventTag::RequestError, $($arg)*) }
}
#[macro_export]
macro_rules! request_warn {
($($arg:tt)*) => { tagged_event!(WARN, EventTag::RequestWarn, $($arg)*) }
}
#[macro_export]
macro_rules! request_info {
($($arg:tt)*) => { tagged_event!(INFO, EventTag::RequestInfo, $($arg)*) }
}
#[macro_export]
macro_rules! request_trace {
($($arg:tt)*) => { tagged_event!(TRACE, EventTag::RequestTrace, $($arg)*) }
}
#[macro_export]
macro_rules! security_critical {
($($arg:tt)*) => { tagged_event!(INFO, EventTag::SecurityCritical, $($arg)*) }
}
#[macro_export]
macro_rules! security_error {
($($arg:tt)*) => { tagged_event!(ERROR, EventTag::SecurityError, $($arg)*) }
}
#[macro_export]
macro_rules! security_info {
($($arg:tt)*) => { tagged_event!(INFO, EventTag::SecurityInfo, $($arg)*) }
}
#[macro_export]
macro_rules! security_access {
($($arg:tt)*) => { tagged_event!(INFO, EventTag::SecurityAccess, $($arg)*) }
}
#[macro_export]
macro_rules! filter_error {
($($arg:tt)*) => { tagged_event!(ERROR, EventTag::FilterError, $($arg)*) }
}
#[macro_export]
macro_rules! filter_warn {
($($arg:tt)*) => { tagged_event!(WARN, EventTag::FilterWarn, $($arg)*) }
}
#[macro_export]
macro_rules! filter_info {
($($arg:tt)*) => { tagged_event!(INFO, EventTag::FilterInfo, $($arg)*) }
}
#[macro_export]
macro_rules! filter_debug {
($($arg:tt)*) => { tagged_event!(DEBUG, EventTag::FilterTrace, $($arg)*) }
}
#[macro_export]
macro_rules! filter_trace {
($($arg:tt)*) => { tagged_event!(TRACE, EventTag::FilterTrace, $($arg)*) }
}
#[macro_export]
macro_rules! perf_trace {
($($arg:tt)*) => { tagged_event!(TRACE, EventTag::PerfTrace, $($arg)*) }
}