lightningdevkit / ldk-node

A ready-to-go node implementation built using LDK.
Other
140 stars 72 forks source link

Log node ID in `start`/`stop` #311

Closed tnull closed 2 months ago

tnull commented 2 months ago

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.

tnull commented 2 months ago

Force-pushed with the following changes:

> git diff-tree -U2 4c76445 41a7955
diff --git a/src/lib.rs b/src/lib.rs
index 5bac708..d9a697a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -220,5 +220,5 @@ impl Node {
                log_info!(
                        self.logger,
-                       "Starting up LDK Node with ID {} on network: {}",
+                       "Starting up LDK Node with node ID {} on network: {}",
                        self.node_id(),
                        self.config.network
@@ -734,5 +734,5 @@ impl Node {
                let runtime = self.runtime.write().unwrap().take().ok_or(Error::NotRunning)?;

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

                // Stop the runtime.

Given the diff since the two ACKs is trivial, I'm going ahead and merging this.