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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// Copyright (c) 2022-present Vadim Glinka
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option.

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "trace")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "trace"))
))] macro_rules!
trace { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "debug")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "debug"))
))] macro_rules!
debug { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "info")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "info"))
))] macro_rules!
info { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "warn")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "warn"))
))] macro_rules!
warn  { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "error")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "error"))
))] macro_rules!
error { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "crit")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "crit"))
))] macro_rules!
crit { ( $($a:tt)* ) => () }


#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "tofile")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "tofile"))
))] macro_rules!
logfile { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "tofile")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "tofile"))
))] macro_rules!
logflush { () => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "glob")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "glob"))
))] macro_rules!
glob_access { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "glob")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "glob"))
))] macro_rules!
glob_replace { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(all(not(debug_assertions), not(feature = "release")))] macro_rules!
newline { 
    ()  => ();
    ( $($a:tt)* ) => ()
}

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "logonly")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "logonly"))
))] macro_rules!
logon { ()  => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "logonly")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "logonly"))
))] macro_rules!
logoff { ()  => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "logonly")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "logonly"))
))] macro_rules!
logonly {
    // On
    ( [#]; $($a:tt)* ) => { $($a)* };
    ( [x]; $($a:tt)* ) => { $($a)* };
    ( [v]; $($a:tt)* ) => { $($a)* };
    ( [+]; $($a:tt)* ) => { $($a)* };
    ( [on]; $($a:tt)* ) => { $($a)* };
    // Off
    ( [ ]; $($a:tt)* ) => { $($a)* };
    ( [_]; $($a:tt)* ) => { $($a)* };
    ( [-]; $($a:tt)* ) => { $($a)* };
    ( [off]; $($a:tt)* ) => { $($a)* };
    // bool variable
    ( [$var:tt]; $($a:tt)* ) => { $($a)* };
    // Without `[]`
    ( $($a:tt)* ) => { $($a)* };
}

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "logmod")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "logmod"))
))] macro_rules!
logmod { ( $($a:tt)* ) => () }

#[macro_export]
#[cfg(
    any(
        all(debug_assertions, not(feature = "logcatch")),
        all(not(debug_assertions), not(feature = "release")),
        all(not(debug_assertions), not(feature = "logcatch"))
))] macro_rules!
logcatch { ( $($a:tt)* ) => () }