rosrust/
log_macros.rs

1#[macro_export]
2macro_rules! ros_log {
3    ($level:expr, $($arg:tt)+) => {
4        let msg = format!($($arg)*);
5        $crate::log($level, msg, file!(), line!());
6    }
7}
8
9#[macro_export]
10macro_rules! ros_debug {
11    ($($arg:tt)*) => {
12        $crate::ros_log!($crate::msg::rosgraph_msgs::Log::DEBUG, $($arg)*);
13    }
14}
15
16#[macro_export]
17macro_rules! ros_info {
18    ($($arg:tt)*) => {
19        $crate::ros_log!($crate::msg::rosgraph_msgs::Log::INFO, $($arg)*);
20    }
21}
22
23#[macro_export]
24macro_rules! ros_warn {
25    ($($arg:tt)*) => {
26        $crate::ros_log!($crate::msg::rosgraph_msgs::Log::WARN, $($arg)*);
27    }
28}
29
30#[macro_export]
31macro_rules! ros_err {
32    ($($arg:tt)*) => {
33        $crate::ros_log!($crate::msg::rosgraph_msgs::Log::ERROR, $($arg)*);
34    }
35}
36
37#[macro_export]
38macro_rules! ros_fatal {
39    ($($arg:tt)*) => {
40        $crate::ros_log!($crate::msg::rosgraph_msgs::Log::FATAL, $($arg)*);
41    }
42}
43
44#[macro_export]
45macro_rules! ros_log_once {
46    ($level:expr, $($arg:tt)+) => {
47        let msg = format!($($arg)*);
48        $crate::log_once($level, msg, file!(), line!());
49    }
50}
51
52#[macro_export]
53macro_rules! ros_debug_once {
54    ($($arg:tt)*) => {
55        $crate::ros_log_once!($crate::msg::rosgraph_msgs::Log::DEBUG, $($arg)*);
56    }
57}
58
59#[macro_export]
60macro_rules! ros_info_once {
61    ($($arg:tt)*) => {
62        $crate::ros_log_once!($crate::msg::rosgraph_msgs::Log::INFO, $($arg)*);
63    }
64}
65
66#[macro_export]
67macro_rules! ros_warn_once {
68    ($($arg:tt)*) => {
69        $crate::ros_log_once!($crate::msg::rosgraph_msgs::Log::WARN, $($arg)*);
70    }
71}
72
73#[macro_export]
74macro_rules! ros_err_once {
75    ($($arg:tt)*) => {
76        $crate::ros_log_once!($crate::msg::rosgraph_msgs::Log::ERROR, $($arg)*);
77    }
78}
79
80#[macro_export]
81macro_rules! ros_fatal_once {
82    ($($arg:tt)*) => {
83        $crate::ros_log_once!($crate::msg::rosgraph_msgs::Log::FATAL, $($arg)*);
84    }
85}
86
87#[macro_export]
88macro_rules! ros_log_throttle {
89    ($period:expr, $level:expr, $($arg:tt)+) => {
90        let msg = format!($($arg)*);
91        $crate::log_throttle($period, $level, msg, file!(), line!());
92    }
93}
94
95#[macro_export]
96macro_rules! ros_debug_throttle {
97    ($period:expr, $($arg:tt)*) => {
98        $crate::ros_log_throttle!($period, $crate::msg::rosgraph_msgs::Log::DEBUG, $($arg)*);
99    }
100}
101
102#[macro_export]
103macro_rules! ros_info_throttle {
104    ($period:expr, $($arg:tt)*) => {
105        $crate::ros_log_throttle!($period, $crate::msg::rosgraph_msgs::Log::INFO, $($arg)*);
106    }
107}
108
109#[macro_export]
110macro_rules! ros_warn_throttle {
111    ($period:expr, $($arg:tt)*) => {
112        $crate::ros_log_throttle!($period, $crate::msg::rosgraph_msgs::Log::WARN, $($arg)*);
113    }
114}
115
116#[macro_export]
117macro_rules! ros_err_throttle {
118    ($period:expr, $($arg:tt)*) => {
119        $crate::ros_log_throttle!($period, $crate::msg::rosgraph_msgs::Log::ERROR, $($arg)*);
120    }
121}
122
123#[macro_export]
124macro_rules! ros_fatal_throttle {
125    ($period:expr, $($arg:tt)*) => {
126        $crate::ros_log_throttle!($period, $crate::msg::rosgraph_msgs::Log::FATAL, $($arg)*);
127    }
128}
129#[macro_export]
130macro_rules! ros_log_throttle_identical {
131    ($period:expr, $level:expr, $($arg:tt)+) => {
132        let msg = format!($($arg)*);
133        $crate::log_throttle_identical($period, $level, msg, file!(), line!());
134    }
135}
136
137#[macro_export]
138macro_rules! ros_debug_throttle_identical {
139    ($period:expr, $($arg:tt)*) => {
140        $crate::ros_log_throttle_identical!($period, $crate::msg::rosgraph_msgs::Log::DEBUG, $($arg)*);
141    }
142}
143
144#[macro_export]
145macro_rules! ros_info_throttle_identical {
146    ($period:expr, $($arg:tt)*) => {
147        $crate::ros_log_throttle_identical!($period, $crate::msg::rosgraph_msgs::Log::INFO, $($arg)*);
148    }
149}
150
151#[macro_export]
152macro_rules! ros_warn_throttle_identical {
153    ($period:expr, $($arg:tt)*) => {
154        $crate::ros_log_throttle_identical!($period, $crate::msg::rosgraph_msgs::Log::WARN, $($arg)*);
155    }
156}
157
158#[macro_export]
159macro_rules! ros_err_throttle_identical {
160    ($period:expr, $($arg:tt)*) => {
161        $crate::ros_log_throttle_identical!($period, $crate::msg::rosgraph_msgs::Log::ERROR, $($arg)*);
162    }
163}
164
165#[macro_export]
166macro_rules! ros_fatal_throttle_identical {
167    ($period:expr, $($arg:tt)*) => {
168        $crate::ros_log_throttle_identical!($period, $crate::msg::rosgraph_msgs::Log::FATAL, $($arg)*);
169    }
170}