Skip to content

Commit cf3b64d

Browse files
committed
Make log macros more usable outside of the lightning crate
... by using explicit paths rather than requiring imports.
1 parent 5691099 commit cf3b64d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lightning/src/util/macro_logger.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,17 @@ macro_rules! log_given_level {
167167
($logger: expr, $lvl:expr, $($arg:tt)+) => (
168168
match $lvl {
169169
#[cfg(not(any(feature = "max_level_off")))]
170-
$crate::util::logger::Level::Error => log_internal!($logger, $lvl, $($arg)*),
170+
$crate::util::logger::Level::Error => $crate::log_internal!($logger, $lvl, $($arg)*),
171171
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error")))]
172-
$crate::util::logger::Level::Warn => log_internal!($logger, $lvl, $($arg)*),
172+
$crate::util::logger::Level::Warn => $crate::log_internal!($logger, $lvl, $($arg)*),
173173
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn")))]
174-
$crate::util::logger::Level::Info => log_internal!($logger, $lvl, $($arg)*),
174+
$crate::util::logger::Level::Info => $crate::log_internal!($logger, $lvl, $($arg)*),
175175
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info")))]
176-
$crate::util::logger::Level::Debug => log_internal!($logger, $lvl, $($arg)*),
176+
$crate::util::logger::Level::Debug => $crate::log_internal!($logger, $lvl, $($arg)*),
177177
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info", feature = "max_level_debug")))]
178-
$crate::util::logger::Level::Trace => log_internal!($logger, $lvl, $($arg)*),
178+
$crate::util::logger::Level::Trace => $crate::log_internal!($logger, $lvl, $($arg)*),
179179
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info", feature = "max_level_debug", feature = "max_level_trace")))]
180-
$crate::util::logger::Level::Gossip => log_internal!($logger, $lvl, $($arg)*),
180+
$crate::util::logger::Level::Gossip => $crate::log_internal!($logger, $lvl, $($arg)*),
181181

182182
#[cfg(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info", feature = "max_level_debug", feature = "max_level_trace"))]
183183
_ => {
@@ -191,46 +191,46 @@ macro_rules! log_given_level {
191191
#[macro_export]
192192
macro_rules! log_error {
193193
($logger: expr, $($arg:tt)*) => (
194-
log_given_level!($logger, $crate::util::logger::Level::Error, $($arg)*);
194+
$crate::log_given_level!($logger, $crate::util::logger::Level::Error, $($arg)*);
195195
)
196196
}
197197

198198
/// Log at the `WARN` level.
199199
#[macro_export]
200200
macro_rules! log_warn {
201201
($logger: expr, $($arg:tt)*) => (
202-
log_given_level!($logger, $crate::util::logger::Level::Warn, $($arg)*);
202+
$crate::log_given_level!($logger, $crate::util::logger::Level::Warn, $($arg)*);
203203
)
204204
}
205205

206206
/// Log at the `INFO` level.
207207
#[macro_export]
208208
macro_rules! log_info {
209209
($logger: expr, $($arg:tt)*) => (
210-
log_given_level!($logger, $crate::util::logger::Level::Info, $($arg)*);
210+
$crate::log_given_level!($logger, $crate::util::logger::Level::Info, $($arg)*);
211211
)
212212
}
213213

214214
/// Log at the `DEBUG` level.
215215
#[macro_export]
216216
macro_rules! log_debug {
217217
($logger: expr, $($arg:tt)*) => (
218-
log_given_level!($logger, $crate::util::logger::Level::Debug, $($arg)*);
218+
$crate::log_given_level!($logger, $crate::util::logger::Level::Debug, $($arg)*);
219219
)
220220
}
221221

222222
/// Log at the `TRACE` level.
223223
#[macro_export]
224224
macro_rules! log_trace {
225225
($logger: expr, $($arg:tt)*) => (
226-
log_given_level!($logger, $crate::util::logger::Level::Trace, $($arg)*)
226+
$crate::log_given_level!($logger, $crate::util::logger::Level::Trace, $($arg)*)
227227
)
228228
}
229229

230230
/// Log at the `GOSSIP` level.
231231
#[macro_export]
232232
macro_rules! log_gossip {
233233
($logger: expr, $($arg:tt)*) => (
234-
log_given_level!($logger, $crate::util::logger::Level::Gossip, $($arg)*);
234+
$crate::log_given_level!($logger, $crate::util::logger::Level::Gossip, $($arg)*);
235235
)
236236
}

0 commit comments

Comments
 (0)