Skip to content

Commit 98cffe3

Browse files
committed
Log structured channel id
Since most log messages no longer include the channel ID in their text, this commit updates the test logger to output the structured channel ID instead. The ID is truncated for readability.
1 parent 99f93f3 commit 98cffe3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning/src/util/logger.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ impl<$($args)?> Record<$($args)?> {
156156

157157
impl<$($args)?> Display for Record<$($args)?> {
158158
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
159+
let chan_id = self.channel_id.map(|id| format!("{}", id));
160+
let chan_str = chan_id.as_deref().and_then(|s| s.get(..6)).unwrap_or("");
159161
let context = format!("{:<5} [{}:{}]", self.level, self.module_path, self.line);
160-
write!(f, "{:<48} {}", context, self.args)
162+
write!(f, "{:<48} {:<6} {}", context, chan_str, self.args)
161163
}
162164
}
163165
} }

0 commit comments

Comments
 (0)