Skip to content

Commit 41a7955

Browse files
committed
Log node ID in start/stop
In scenarios with multiple interconnected nodes, reading user logs can be much easier once we know which log file is for a node with a particular node ID. Here, we simply log the node ID on startup and shutdown to allow to associate any given log file with the node's ID.
1 parent 0e02969 commit 41a7955

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,12 @@ impl Node {
217217
return Err(Error::AlreadyRunning);
218218
}
219219

220-
log_info!(self.logger, "Starting up LDK Node on network: {}", self.config.network);
220+
log_info!(
221+
self.logger,
222+
"Starting up LDK Node with node ID {} on network: {}",
223+
self.node_id(),
224+
self.config.network
225+
);
221226

222227
let runtime = tokio::runtime::Builder::new_multi_thread().enable_all().build().unwrap();
223228

@@ -728,7 +733,7 @@ impl Node {
728733
pub fn stop(&self) -> Result<(), Error> {
729734
let runtime = self.runtime.write().unwrap().take().ok_or(Error::NotRunning)?;
730735

731-
log_info!(self.logger, "Shutting down LDK Node...");
736+
log_info!(self.logger, "Shutting down LDK Node with node ID {}...", self.node_id());
732737

733738
// Stop the runtime.
734739
match self.stop_sender.send(()) {

0 commit comments

Comments
 (0)