1#[macro_export(local_inner_macros)]
2macro_rules! error {
3 ($($arg:tt)+) => (log!($crate::components::common::NotificationLevel::Error, $($arg)+))
5}
6
7#[macro_export(local_inner_macros)]
8macro_rules! warn {
9 ($($arg:tt)+) => (log!($crate::components::common::NotificationLevel::Warn, $($arg)+))
11}
12
13#[macro_export(local_inner_macros)]
14macro_rules! info {
15 ($($arg:tt)+) => (log!($crate::components::common::NotificationLevel::Info, $($arg)+))
17}
18
19#[macro_export(local_inner_macros)]
20macro_rules! debug {
21 ($($arg:tt)+) => (log!($crate::components::common::NotificationLevel::Debug, $($arg)+))
23}
24
25#[macro_export(local_inner_macros)]
26macro_rules! trace {
27 ($($arg:tt)+) => (log!($crate::components::common::NotificationLevel::Trace, $($arg)+))
29}
30
31#[macro_export(local_inner_macros)]
32macro_rules! log {
33 ($lvl:expr, $($arg:tt)+) => ({
35 let lvl = $lvl;
36 if lvl <= $crate::components::common::NotificationLevel::Trace && lvl <= $crate::logging::max_level() {
37 let _ = $crate::logging::COMPONENT_LOGGER.with(|v| {
38 let msngr = v.borrow();
39 msngr.log(std::format!($($arg)+), lvl);
40 Ok::<(), ()>(())
41 });
42 }
43 });
44}
45
46#[macro_export(local_inner_macros)]
48macro_rules! send_message {
49 ($arg:expr) => {
50 $crate::logging::COMPONENT_LOGGER.with(|v| {
51 let msngr = v.borrow();
52 msngr.send($arg)
53 })
54 };
55}
56#[macro_export(local_inner_macros)]
57macro_rules! send_message_timeout {
58 ($msg:expr, $timeout:expr) => {
59 $crate::logging::COMPONENT_LOGGER.with(|v| {
60 let msngr = v.borrow();
61 msngr.send_timeout($msg, $timeout)
62 })
63 };
64}
65#[macro_export(local_inner_macros)]
66macro_rules! try_send_message {
67 ($msg:expr) => {
68 $crate::logging::COMPONENT_LOGGER.with(|v| {
69 let msngr = v.borrow();
70 msngr.try_send($msg)
71 })
72 };
73}