|
11 | 11 | // macros such as `log::info!` from the IDE.
|
12 | 12 | use the_log_crate;
|
13 | 13 |
|
14 |
| -pub use the_log_crate::{error, info, warn}; |
| 14 | +pub(crate) use the_log_crate::{error, info, warn}; |
15 | 15 |
|
16 | 16 | cfg_if::cfg_if! {
|
17 | 17 | if #[cfg(all(not(debug_assertions), not(feature = "hot_log")))] {
|
18 | 18 | // If it is release build and the feature "hot_log" is not enabled,
|
19 | 19 | // then we define verbose logs as no-op in release build.
|
20 | 20 |
|
21 |
| - /// The `log::debug!` macro is disabled in release build. Use the "hot_log" feature to enable. |
22 |
| - #[cfg(not(feature = "hot_log"))] |
| 21 | + /// The `log::debug!` macro is disabled in release build. |
| 22 | + /// Use the "hot_log" feature to enable. |
23 | 23 | macro_rules! debug {
|
24 |
| - (target: $target:expr, $($arg:tt)+) => {}; |
25 | 24 | ($($arg:tt)+) => {}
|
26 | 25 | }
|
27 | 26 |
|
28 |
| - /// The `log::trace!` macro is disabled in release build. Use the "hot_log" feature to enable. |
29 |
| - #[cfg(not(feature = "hot_log"))] |
| 27 | + /// The `log::trace!` macro is disabled in release build. |
| 28 | + /// Use the "hot_log" feature to enable. |
30 | 29 | macro_rules! trace {
|
31 |
| - (target: $target:expr, $($arg:tt)+) => {}; |
32 | 30 | ($($arg:tt)+) => {}
|
33 | 31 | }
|
34 | 32 |
|
| 33 | + // By default, a macro has no path-based scope. |
| 34 | + // The following allows other modules to access the macros with `crate::util::log::debug` |
| 35 | + // and `crate::util::log::trace`. |
| 36 | + pub(crate) use debug; |
| 37 | + pub(crate) use trace; |
| 38 | + |
35 | 39 | } else {
|
36 | 40 | // Otherwise simply import the macros from the `log` crate.
|
37 |
| - pub use the_log_crate::{debug, trace}; |
| 41 | + pub(crate) use the_log_crate::{debug, trace}; |
38 | 42 | }
|
39 | 43 | }
|
0 commit comments