nolog/
disabled.rs

1// Copyright (c) 2022-present Vadim Glinka
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option.
7
8#[macro_export]
9#[cfg(
10    any(
11        all(debug_assertions, not(feature = "trace")),
12        all(not(debug_assertions), not(feature = "release")),
13        all(not(debug_assertions), not(feature = "trace"))
14))] macro_rules!
15trace { ( $($a:tt)* ) => () }
16
17#[macro_export]
18#[cfg(
19    any(
20        all(debug_assertions, not(feature = "debug")),
21        all(not(debug_assertions), not(feature = "release")),
22        all(not(debug_assertions), not(feature = "debug"))
23))] macro_rules!
24debug { ( $($a:tt)* ) => () }
25
26#[macro_export]
27#[cfg(
28    any(
29        all(debug_assertions, not(feature = "info")),
30        all(not(debug_assertions), not(feature = "release")),
31        all(not(debug_assertions), not(feature = "info"))
32))] macro_rules!
33info { ( $($a:tt)* ) => () }
34
35#[macro_export]
36#[cfg(
37    any(
38        all(debug_assertions, not(feature = "warn")),
39        all(not(debug_assertions), not(feature = "release")),
40        all(not(debug_assertions), not(feature = "warn"))
41))] macro_rules!
42warn  { ( $($a:tt)* ) => () }
43
44#[macro_export]
45#[cfg(
46    any(
47        all(debug_assertions, not(feature = "error")),
48        all(not(debug_assertions), not(feature = "release")),
49        all(not(debug_assertions), not(feature = "error"))
50))] macro_rules!
51error { ( $($a:tt)* ) => () }
52
53#[macro_export]
54#[cfg(
55    any(
56        all(debug_assertions, not(feature = "crit")),
57        all(not(debug_assertions), not(feature = "release")),
58        all(not(debug_assertions), not(feature = "crit"))
59))] macro_rules!
60crit { ( $($a:tt)* ) => () }
61
62
63#[macro_export]
64#[cfg(
65    any(
66        all(debug_assertions, not(feature = "tofile")),
67        all(not(debug_assertions), not(feature = "release")),
68        all(not(debug_assertions), not(feature = "tofile"))
69))] macro_rules!
70logfile { ( $($a:tt)* ) => () }
71
72#[macro_export]
73#[cfg(
74    any(
75        all(debug_assertions, not(feature = "tofile")),
76        all(not(debug_assertions), not(feature = "release")),
77        all(not(debug_assertions), not(feature = "tofile"))
78))] macro_rules!
79logflush { () => () }
80
81#[macro_export]
82#[cfg(
83    any(
84        all(debug_assertions, not(feature = "glob")),
85        all(not(debug_assertions), not(feature = "release")),
86        all(not(debug_assertions), not(feature = "glob"))
87))] macro_rules!
88glob_access { ( $($a:tt)* ) => () }
89
90#[macro_export]
91#[cfg(
92    any(
93        all(debug_assertions, not(feature = "glob")),
94        all(not(debug_assertions), not(feature = "release")),
95        all(not(debug_assertions), not(feature = "glob"))
96))] macro_rules!
97glob_replace { ( $($a:tt)* ) => () }
98
99#[macro_export]
100#[cfg(all(not(debug_assertions), not(feature = "release")))] macro_rules!
101newline { 
102    ()  => ();
103    ( $($a:tt)* ) => ()
104}
105
106#[macro_export]
107#[cfg(
108    any(
109        all(debug_assertions, not(feature = "logonly")),
110        all(not(debug_assertions), not(feature = "release")),
111        all(not(debug_assertions), not(feature = "logonly"))
112))] macro_rules!
113logon { ()  => () }
114
115#[macro_export]
116#[cfg(
117    any(
118        all(debug_assertions, not(feature = "logonly")),
119        all(not(debug_assertions), not(feature = "release")),
120        all(not(debug_assertions), not(feature = "logonly"))
121))] macro_rules!
122logoff { ()  => () }
123
124#[macro_export]
125#[cfg(
126    any(
127        all(debug_assertions, not(feature = "logonly")),
128        all(not(debug_assertions), not(feature = "release")),
129        all(not(debug_assertions), not(feature = "logonly"))
130))] macro_rules!
131logonly {
132    // On
133    ( [#]; $($a:tt)* ) => { $($a)* };
134    ( [x]; $($a:tt)* ) => { $($a)* };
135    ( [v]; $($a:tt)* ) => { $($a)* };
136    ( [+]; $($a:tt)* ) => { $($a)* };
137    ( [on]; $($a:tt)* ) => { $($a)* };
138    // Off
139    ( [ ]; $($a:tt)* ) => { $($a)* };
140    ( [_]; $($a:tt)* ) => { $($a)* };
141    ( [-]; $($a:tt)* ) => { $($a)* };
142    ( [off]; $($a:tt)* ) => { $($a)* };
143    // bool variable
144    ( [$var:tt]; $($a:tt)* ) => { $($a)* };
145    // Without `[]`
146    ( $($a:tt)* ) => { $($a)* };
147}
148
149#[macro_export]
150#[cfg(
151    any(
152        all(debug_assertions, not(feature = "logmod")),
153        all(not(debug_assertions), not(feature = "release")),
154        all(not(debug_assertions), not(feature = "logmod"))
155))] macro_rules!
156logmod { ( $($a:tt)* ) => () }
157
158#[macro_export]
159#[cfg(
160    any(
161        all(debug_assertions, not(feature = "logcatch")),
162        all(not(debug_assertions), not(feature = "release")),
163        all(not(debug_assertions), not(feature = "logcatch"))
164))] macro_rules!
165logcatch { ( $($a:tt)* ) => () }
166
167
168
169
170