Skip to content

Commit 436ff73

Browse files
Septiaslink2xt
authored andcommitted
optimize logs
1 parent fb547d9 commit 436ff73

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/peer_channels.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ impl Iroh {
154154

155155
self.gossip.broadcast(topic, data.into()).await?;
156156

157-
if env::var("REALTIME_DEBUG").is_ok() {
158-
info!(ctx, "Sent realtime data");
159-
}
160-
161157
Ok(())
162158
}
163159

@@ -353,7 +349,9 @@ pub async fn send_webxdc_realtime_advertisement(
353349
msg.param.set_cmd(SystemMessage::IrohNodeAddr);
354350
msg.in_reply_to = Some(webxdc.rfc724_mid.clone());
355351
send_msg(ctx, webxdc.chat_id, &mut msg).await?;
356-
info!(ctx, "IROH_REALTIME: Sent realtime advertisement");
352+
if env::var("REALTIME_DEBUG").is_ok() {
353+
info!(ctx, "IROH_REALTIME: Sent realtime advertisement");
354+
}
357355
Ok(conn)
358356
}
359357

@@ -369,6 +367,7 @@ pub async fn leave_webxdc_realtime(ctx: &Context, msg_id: MsgId) -> Result<()> {
369367
let iroh = ctx.get_or_try_init_peer_channel().await?;
370368
iroh.leave_realtime(get_iroh_topic_for_msg(ctx, msg_id).await?)
371369
.await?;
370+
372371
info!(ctx, "IROH_REALTIME: Left gossip for message {msg_id}");
373372

374373
Ok(())
@@ -436,11 +435,12 @@ async fn subscribe_loop(
436435
let event = stream.recv().await?;
437436
match event {
438437
IrohEvent::NeighborUp(node) => {
439-
info!(context, "IROH_REALTIME: NeighborUp: {}", node.to_string());
440438
iroh_add_peer_for_topic(context, msg_id, topic, node, None).await?;
441439
}
442440
IrohEvent::Received(event) => {
443-
info!(context, "IROH_REALTIME: Received realtime data");
441+
if env::var("REALTIME_DEBUG").is_ok() {
442+
info!(context, "IROH_REALTIME: Received realtime data");
443+
}
444444
context.emit_event(EventType::WebxdcRealtimeData {
445445
msg_id,
446446
data: event

0 commit comments

Comments
 (0)