From 00e1f9342feef6374ef6b0010a54ca3796cdc230 Mon Sep 17 00:00:00 2001 From: Tanguy Date: Tue, 1 Feb 2022 18:35:48 +0100 Subject: [PATCH] Fix identify log for json_sink (#690) --- libp2p/protocols/identify.nim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libp2p/protocols/identify.nim b/libp2p/protocols/identify.nim index 28ae80131..dfa081334 100644 --- a/libp2p/protocols/identify.nim +++ b/libp2p/protocols/identify.nim @@ -9,7 +9,7 @@ {.push raises: [Defect].} -import options +import std/[sequtils, options, strutils] import chronos, chronicles import ../protobuf/minprotobuf, ../peerinfo, @@ -107,11 +107,14 @@ proc decodeMsg*(buf: seq[byte]): Option[IdentifyInfo] = iinfo.protoVersion = some(protoVersion) if r6.get(): iinfo.agentVersion = some(agentVersion) - debug "decodeMsg: decoded message", pubkey = ($pubkey).shortLog, - addresses = $iinfo.addrs, protocols = $iinfo.protos, - observable_address = $iinfo.observedAddr, - proto_version = $iinfo.protoVersion, - agent_version = $iinfo.agentVersion + debug "decodeMsg: decoded identify", pubkey = ($pubkey).shortLog, + addresses = iinfo.addrs.mapIt($it).join(","), + protocols = iinfo.protos.mapIt($it).join(","), + observable_address = + if iinfo.observedAddr.isSome(): $iinfo.observedAddr.get() + else: "None", + proto_version = iinfo.protoVersion.get("None"), + agent_version = iinfo.agentVersion.get("None") some(iinfo) else: trace "decodeMsg: failed to decode received message"