Skip to content

Commit 75107c9

Browse files
Make logger macros public
These will be used in upcoming commits for the BackgroundProcessor to log.
1 parent 879e309 commit 75107c9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lightning/src/util/macro_logger.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,17 @@ macro_rules! log_spendable {
155155
}
156156
}
157157

158+
/// Create a new Record and log it. You probably don't want to use this macro directly,
159+
/// but it needs to be exported so `log_trace` etc can use it in external crates.
160+
#[macro_export]
158161
macro_rules! log_internal {
159162
($logger: expr, $lvl:expr, $($arg:tt)+) => (
160-
$logger.log(&::util::logger::Record::new($lvl, format_args!($($arg)+), module_path!(), file!(), line!()));
163+
$logger.log(&$crate::util::logger::Record::new($lvl, format_args!($($arg)+), module_path!(), file!(), line!()));
161164
);
162165
}
163166

167+
/// Log an error.
168+
#[macro_export]
164169
macro_rules! log_error {
165170
($logger: expr, $($arg:tt)*) => (
166171
#[cfg(not(any(feature = "max_level_off")))]
@@ -189,6 +194,8 @@ macro_rules! log_debug {
189194
)
190195
}
191196

197+
/// Log a trace log.
198+
#[macro_export]
192199
macro_rules! log_trace {
193200
($logger: expr, $($arg:tt)*) => (
194201
#[cfg(not(any(feature = "max_level_off", feature = "max_level_error", feature = "max_level_warn", feature = "max_level_info", feature = "max_level_debug")))]

lightning/src/util/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ pub(crate) mod transaction_utils;
2525

2626
#[macro_use]
2727
pub(crate) mod ser_macros;
28+
29+
/// Logging macro utilities.
2830
#[macro_use]
29-
pub(crate) mod macro_logger;
31+
pub mod macro_logger;
3032

3133
// These have to come after macro_logger to build
3234
pub mod logger;

0 commit comments

Comments
 (0)