use bitcoin::hash_types::Txid;
use bitcoin::blockdata::transaction::Transaction;
use crate::routing::router::Route;
use crate::ln::chan_utils::HTLCClaim;
use bitcoin::hash_types::Txid;
use bitcoin::blockdata::transaction::Transaction;
use crate::routing::router::Route;
use crate::ln::chan_utils::HTLCClaim;
pub(crate) struct DebugFundingChannelId<'a>(pub &'a Txid, pub u16);
impl<'a> core::fmt::Display for DebugFundingChannelId<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
pub(crate) struct DebugFundingChannelId<'a>(pub &'a Txid, pub u16);
impl<'a> core::fmt::Display for DebugFundingChannelId<'a> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
- for i in (OutPoint { txid: self.0.clone(), index: self.1 }).to_channel_id().iter() {
- write!(f, "{:02x}", i)?;
- }
- Ok(())
+ (OutPoint { txid: self.0.clone(), index: self.1 }).to_channel_id().fmt(f)
pub(crate) struct DebugFundingInfo<'a, T: 'a>(pub &'a (OutPoint, T));
impl<'a, T> core::fmt::Display for DebugFundingInfo<'a, T> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
pub(crate) struct DebugFundingInfo<'a, T: 'a>(pub &'a (OutPoint, T));
impl<'a, T> core::fmt::Display for DebugFundingInfo<'a, T> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
for (idx, p) in self.0.paths.iter().enumerate() {
writeln!(f, "path {}:", idx)?;
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
for (idx, p) in self.0.paths.iter().enumerate() {
writeln!(f, "path {}:", idx)?;
writeln!(f, " node_id: {}, short_channel_id: {}, fee_msat: {}, cltv_expiry_delta: {}", log_pubkey!(h.pubkey), h.short_channel_id, h.fee_msat, h.cltv_expiry_delta)?;
}
writeln!(f, " node_id: {}, short_channel_id: {}, fee_msat: {}, cltv_expiry_delta: {}", log_pubkey!(h.pubkey), h.short_channel_id, h.fee_msat, h.cltv_expiry_delta)?;
}
#[macro_export]
macro_rules! log_internal {
($logger: expr, $lvl:expr, $($arg:tt)+) => (
#[macro_export]
macro_rules! log_internal {
($logger: expr, $lvl:expr, $($arg:tt)+) => (
- $logger.log(&$crate::util::logger::Record::new($lvl, format_args!($($arg)+), module_path!(), file!(), line!()))
+ $logger.log($crate::util::logger::Record::new($lvl, None, None, format_args!($($arg)+), module_path!(), file!(), line!()))
($logger: expr, $lvl:expr, $($arg:tt)+) => (
match $lvl {
#[cfg(not(any(feature = "max_level_off")))]
($logger: expr, $lvl:expr, $($arg:tt)+) => (
match $lvl {
#[cfg(not(any(feature = "max_level_off")))]
- $crate::util::logger::Level::Error => log_internal!($logger, $lvl, $($arg)*),
+ $crate::util::logger::Level::Error => $crate::log_internal!($logger, $lvl, $($arg)*),
- $crate::util::logger::Level::Warn => log_internal!($logger, $lvl, $($arg)*),
+ $crate::util::logger::Level::Warn => $crate::log_internal!($logger, $lvl, $($arg)*),
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn")))]
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn")))]
- $crate::util::logger::Level::Info => log_internal!($logger, $lvl, $($arg)*),
+ $crate::util::logger::Level::Info => $crate::log_internal!($logger, $lvl, $($arg)*),
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info")))]
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info")))]
- $crate::util::logger::Level::Debug => log_internal!($logger, $lvl, $($arg)*),
+ $crate::util::logger::Level::Debug => $crate::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")))]
#[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)*),
+ $crate::util::logger::Level::Trace => $crate::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")))]
#[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)*),
+ $crate::util::logger::Level::Gossip => $crate::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", feature = "max_level_trace"))]
_ => {
#[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"))]
_ => {
#[macro_export]
macro_rules! log_gossip {
($logger: expr, $($arg:tt)*) => (
#[macro_export]
macro_rules! log_gossip {
($logger: expr, $($arg:tt)*) => (