Skip to content

Commit b0c3da7

Browse files
feat(swarm): log local peer id on swarm creation
Closes #4394. Pull-Request: #4439.
1 parent 581b1e4 commit b0c3da7

File tree

18 files changed

+18
-23
lines changed

18 files changed

+18
-23
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/autonat/src/bin/autonat_client.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
5151

5252
let local_key = identity::Keypair::generate_ed25519();
5353
let local_peer_id = PeerId::from(local_key.public());
54-
println!("Local peer id: {local_peer_id:?}");
5554

5655
let transport = tcp::async_io::Transport::default()
5756
.upgrade(Version::V1Lazy)

examples/autonat/src/bin/autonat_server.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
4343

4444
let local_key = identity::Keypair::generate_ed25519();
4545
let local_peer_id = PeerId::from(local_key.public());
46-
println!("Local peer id: {local_peer_id:?}");
4746

4847
let transport = tcp::async_io::Transport::default()
4948
.upgrade(Version::V1Lazy)

examples/chat-example/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ struct MyBehaviour {
4444
#[async_std::main]
4545
async fn main() -> Result<(), Box<dyn Error>> {
4646
// Create a random PeerId
47+
env_logger::init();
4748
let id_keys = identity::Keypair::generate_ed25519();
4849
let local_peer_id = PeerId::from(id_keys.public());
49-
println!("Local peer id: {local_peer_id}");
5050

5151
// Set up an encrypted DNS-enabled TCP Transport over the yamux protocol.
5252
let tcp_transport = tcp::async_io::Transport::new(tcp::Config::default().nodelay(true))

examples/dcutr/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ fn main() -> Result<(), Box<dyn Error>> {
8787

8888
let local_key = generate_ed25519(opts.secret_key_seed);
8989
let local_peer_id = PeerId::from(local_key.public());
90-
info!("Local peer id: {:?}", local_peer_id);
9190

9291
let (relay_transport, client) = relay::client::new(local_peer_id);
9392

examples/identify/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ license = "MIT"
88
[dependencies]
99
async-std = { version = "1.12", features = ["attributes"] }
1010
async-trait = "0.1"
11+
env_logger = "0.10"
1112
futures = "0.3.28"
1213
libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux"] }

examples/identify/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ use std::error::Error;
3131

3232
#[async_std::main]
3333
async fn main() -> Result<(), Box<dyn Error>> {
34+
env_logger::init();
3435
let local_key = identity::Keypair::generate_ed25519();
3536
let local_peer_id = PeerId::from(local_key.public());
36-
println!("Local peer id: {local_peer_id:?}");
3737

3838
let transport = tcp::async_io::Transport::default()
3939
.upgrade(Version::V1Lazy)

examples/metrics/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ fn main() -> Result<(), Box<dyn Error>> {
4141
let local_key = identity::Keypair::generate_ed25519();
4242
let local_peer_id = PeerId::from(local_key.public());
4343
let local_pub_key = local_key.public();
44-
info!("Local peer id: {local_peer_id:?}");
4544

4645
let mut swarm = SwarmBuilder::without_executor(
4746
tcp::async_io::Transport::default()

examples/ping-example/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ license = "MIT"
88
[dependencies]
99
async-std = { version = "1.12", features = ["attributes"] }
1010
async-trait = "0.1"
11+
env_logger = "0.10.0"
1112
futures = "0.3.28"
1213
libp2p = { path = "../../libp2p", features = ["async-std", "dns", "macros", "noise", "ping", "tcp", "websocket", "yamux"] }

examples/ping-example/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ use std::error::Error;
3131

3232
#[async_std::main]
3333
async fn main() -> Result<(), Box<dyn Error>> {
34+
env_logger::init();
3435
let local_key = identity::Keypair::generate_ed25519();
3536
let local_peer_id = PeerId::from(local_key.public());
36-
println!("Local peer id: {local_peer_id:?}");
3737

3838
let transport = tcp::async_io::Transport::default()
3939
.upgrade(Version::V1Lazy)

0 commit comments

Comments
 (0)