Skip to content

Commit 01f7b40

Browse files
authored
fix: add example metrics's tracing::info
Adding a Minimal `println!()` Syntax for Metrics Example Pull-Request: libp2p#5440.
1 parent 3da7d91 commit 01f7b40

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/metrics/src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ async fn main() -> Result<(), Box<dyn Error>> {
6666

6767
loop {
6868
match swarm.select_next_some().await {
69+
SwarmEvent::NewListenAddr { address, .. } => {
70+
tracing::info!(
71+
"Local node is listening on\n {}/p2p/{}",
72+
address,
73+
swarm.local_peer_id()
74+
);
75+
}
6976
SwarmEvent::Behaviour(BehaviourEvent::Ping(ping_event)) => {
7077
tracing::info!(?ping_event);
7178
metrics.record(&ping_event);

0 commit comments

Comments
 (0)