Add seed node info, add line break

This commit is contained in:
chimp1984 2021-01-06 00:58:40 -05:00
parent a346db696f
commit d13b7e70fa
No known key found for this signature in database
GPG key ID: 9801B4EC591F90E3
2 changed files with 3 additions and 2 deletions

View file

@ -57,7 +57,7 @@ public class ConnectionStatistics implements MessageListener {
String ls = System.lineSeparator(); String ls = System.lineSeparator();
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
String conInstance = connection instanceof InboundConnection ? "Inbound" : "Outbound"; String conInstance = connection instanceof InboundConnection ? "Inbound" : "Outbound";
return String.format("%s connection to %s " + return String.format("%s connection to %s%s " +
"of type %s " + "of type %s " +
"was creation %s sec. ago (on %s) " + "was creation %s sec. ago (on %s) " +
"with UID %s." + ls + "with UID %s." + ls +
@ -65,6 +65,7 @@ public class ConnectionStatistics implements MessageListener {
"Sent data: %s;" + ls + "Sent data: %s;" + ls +
"Received data: %s;", "Received data: %s;",
conInstance, conInstance,
connectionState.isSeedNode() ? "seed node " : "",
connection.getPeersNodeAddressOptional().map(NodeAddress::getFullAddress).orElse("N/A"), connection.getPeersNodeAddressOptional().map(NodeAddress::getFullAddress).orElse("N/A"),
connectionState.getPeerType().name(), connectionState.getPeerType().name(),
(now - connectionCreationTimeStamp) / 1000, (now - connectionCreationTimeStamp) / 1000,

View file

@ -809,7 +809,7 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
AtomicInteger counter = new AtomicInteger(); AtomicInteger counter = new AtomicInteger();
networkNode.getAllConnections().stream() networkNode.getAllConnections().stream()
.sorted(Comparator.comparingLong(o -> o.getStatistic().getLastActivityTimestamp())) .sorted(Comparator.comparingLong(o -> o.getStatistic().getLastActivityTimestamp()))
.forEach(e -> sb.append("Connection ") .forEach(e -> sb.append(ls).append("Connection ")
.append(counter.incrementAndGet()).append(": ") .append(counter.incrementAndGet()).append(": ")
.append(e.getConnectionStatistics().getInfo()).append(ls)); .append(e.getConnectionStatistics().getInfo()).append(ls));
log.error(sb.toString()); log.error(sb.toString());