Merge pull request #1389 from lightning-signer/2022-03-bitcoin
[rust-lightning] / lightning / src / util / macro_logger.rs
index 788bc5eca11cc1de9e28cee1d6a64bcbe4419219..eadfdbdfc67aaeea13477dc7b5315df4f4ab42cd 100644 (file)
@@ -12,7 +12,7 @@ use chain::keysinterface::SpendableOutputDescriptor;
 
 use bitcoin::hash_types::Txid;
 use bitcoin::blockdata::transaction::Transaction;
-use bitcoin::secp256k1::key::PublicKey;
+use bitcoin::secp256k1::PublicKey;
 
 use routing::router::Route;
 use ln::chan_utils::HTLCType;
@@ -174,8 +174,10 @@ macro_rules! log_given_level {
                        $crate::util::logger::Level::Debug => log_internal!($logger, $lvl, $($arg)*),
                        #[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info", feature = "max_level_debug")))]
                        $crate::util::logger::Level::Trace => log_internal!($logger, $lvl, $($arg)*),
+                       #[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")))]
+                       $crate::util::logger::Level::Gossip => log_internal!($logger, $lvl, $($arg)*),
 
-                       #[cfg(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info", feature = "max_level_debug"))]
+                       #[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"))]
                        _ => {
                                // The level is disabled at compile-time
                        },
@@ -213,6 +215,13 @@ macro_rules! log_debug {
 #[macro_export]
 macro_rules! log_trace {
        ($logger: expr, $($arg:tt)*) => (
-               log_given_level!($logger, $crate::util::logger::Level::Trace, $($arg)*);
+               log_given_level!($logger, $crate::util::logger::Level::Trace, $($arg)*)
+       )
+}
+
+/// Log a gossip log.
+macro_rules! log_gossip {
+       ($logger: expr, $($arg:tt)*) => (
+               log_given_level!($logger, $crate::util::logger::Level::Gossip, $($arg)*);
        )
 }