1crate::evident::create_set_event_macro!(
2 id_type = logid::log_id::LogId,
3 msg_type = logid::logging::msg::LogMsg,
4 entry_type = logid::logging::event_entry::LogEventEntry,
5 interm_event_type = logid::logging::intermediary_event::IntermediaryLogEvent
6);
7
8#[macro_export]
9macro_rules! log {
10 ($any:expr) => {
11 {
12 let s = $any.to_string();
13 $crate::set_event!(($any).into(), s).finalize()
14 }
15 };
16 ($any:expr, $(add:$addon:expr),*) => {
17 {
18 let s = $any.to_string();
19 $crate::set_event!(($any).into(), s)$(.add_addon($addon))*.finalize()
20 }
21 };
22 ($any:expr, $msg:expr) => {
23 $crate::set_event!(($any).into(), $msg).finalize()
24 };
25 ($any:expr, $msg:expr, $(add:$addon:expr),*) => {
26 $crate::set_event!(($any).into(), $msg)$(.add_addon($addon))*.finalize()
27 };
28
29 ($any:expr, $fmt_fn:expr, $fmt_data:expr) => {
31 $crate::set_event!(($any).into(), $crate::logging::msg::FmtMsg::new($fmt_fn, $fmt_data)).finalize()
32 };
33 ($any:expr, $fmt_fn:expr, $fmt_data:expr, $(add:$addon:expr),*) => {
34 $crate::set_event!(($any).into(), $crate::logging::msg::FmtMsg::new($fmt_fn, $fmt_data))$(.add_addon($addon))*.finalize()
35 };
36}
37
38#[macro_export]
39macro_rules! err {
40 ($error:expr) => {
41 {
42 $crate::log!($error);
43 Err($error)
44 }
45 };
46 ($error:expr, $(add:$addon:expr),*) => {
47 {
48 $crate::log!($error, $(add:$addon),*);
49 Err($error)
50 }
51 };
52 ($error:expr, $msg:expr) => {
53 {
54 $crate::log!($error, $msg);
55 Err($error)
56 }
57 };
58 ($error:expr, $msg:expr, $(add:$addon:expr),*) => {
59 {
60 $crate::log!($error, $msg, $(add:$addon),*);
61 Err($error)
62 }
63 };
64
65 ($error:expr, $fmt_fn:expr, $fmt_data:expr) => {
66 {
67 $crate::log!($error, $fmt_fn, $fmt_data);
68 Err($error)
69 }
70 };
71 ($error:expr, $fmt_fn:expr, $fmt_data:expr, $(add:$addon:expr),*) => {
72 {
73 $crate::log!($error, $fmt_fn, $fmt_data, $(add:$addon),*);
74 Err($error)
75 }
76 };
77}
78
79#[macro_export]
80macro_rules! pipe {
81 ($any:expr) => {
82 {
83 $crate::log!($any);
84 $any
85 }
86 };
87 ($any:expr, $(add:$addon:expr),*) => {
88 {
89 $crate::log!($any, $(add:$addon),*);
90 $any
91 }
92 };
93 ($any:expr, $msg:expr) => {
94 {
95 $crate::log!($any, $msg);
96 $any
97 }
98 };
99 ($any:expr, $msg:expr, $(add:$addon:expr),*) => {
100 {
101 $crate::log!($any, $msg, $(add:$addon),*);
102 $any
103 }
104 };
105
106 ($any:expr, $fmt_fn:expr, $fmt_data:expr) => {
107 {
108 $crate::log!($any, $fmt_fn, $fmt_data);
109 $any
110 }
111 };
112 ($any:expr, $fmt_fn:expr, $fmt_data:expr, $(add:$addon:expr),*) => {
113 {
114 $crate::log!($any, $fmt_fn, $fmt_data, $(add:$addon),*);
115 $any
116 }
117 };
118}