Skip to content

Commit 33c1dca

Browse files
authored
Add server address and cluster id to events' toString output (#1008)
JAVA-4732
1 parent ba39a2c commit 33c1dca

11 files changed

+36
-16
lines changed

driver-core/src/main/com/mongodb/event/ConnectionCheckOutFailedEvent.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ public Reason getReason() {
8888
@Override
8989
public String toString() {
9090
return "ConnectionCheckOutFailedEvent{"
91-
+ "serverId=" + serverId
92-
+ " reason=" + reason
93-
+ '}';
91+
+ "server=" + serverId.getAddress()
92+
+ ", clusterId=" + serverId.getClusterId()
93+
+ ", reason=" + reason
94+
+ '}';
9495
}
9596
}

driver-core/src/main/com/mongodb/event/ConnectionCheckOutStartedEvent.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public ServerId getServerId() {
4949
@Override
5050
public String toString() {
5151
return "ConnectionCheckOutStartedEvent{"
52-
+ "serverId=" + serverId
53-
+ '}';
52+
+ "server=" + serverId.getAddress()
53+
+ ", clusterId=" + serverId.getClusterId()
54+
+ '}';
5455
}
5556
}

driver-core/src/main/com/mongodb/event/ConnectionCheckedInEvent.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public ConnectionId getConnectionId() {
4949
@Override
5050
public String toString() {
5151
return "ConnectionCheckedInEvent{"
52-
+ "connectionId=" + connectionId
53-
+ '}';
52+
+ "connectionId=" + connectionId
53+
+ ", server=" + connectionId.getServerId().getAddress()
54+
+ ", clusterId=" + connectionId.getServerId().getClusterId()
55+
+ '}';
5456
}
5557
}

driver-core/src/main/com/mongodb/event/ConnectionCheckedOutEvent.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public ConnectionId getConnectionId() {
4949
@Override
5050
public String toString() {
5151
return "ConnectionCheckedOutEvent{"
52-
+ "connectionId=" + connectionId
53-
+ '}';
52+
+ "connectionId=" + connectionId
53+
+ ", server=" + connectionId.getServerId().getAddress()
54+
+ ", clusterId=" + connectionId.getServerId().getClusterId()
55+
+ '}';
5456
}
5557
}

driver-core/src/main/com/mongodb/event/ConnectionClosedEvent.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ public Reason getReason() {
8787
@Override
8888
public String toString() {
8989
return "ConnectionClosedEvent{"
90-
+ " connectionId=" + connectionId
91-
+ " reason=" + reason
92-
+ '}';
90+
+ "connectionId=" + connectionId
91+
+ ", server=" + connectionId.getServerId().getAddress()
92+
+ ", clusterId=" + connectionId.getServerId().getClusterId()
93+
+ ", reason=" + reason
94+
+ '}';
9395
}
9496
}

driver-core/src/main/com/mongodb/event/ConnectionCreatedEvent.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public ConnectionId getConnectionId() {
4949
@Override
5050
public String toString() {
5151
return "ConnectionCreatedEvent{"
52-
+ " connectionId=" + connectionId
53-
+ '}';
52+
+ "connectionId=" + connectionId
53+
+ ", server=" + connectionId.getServerId().getAddress()
54+
+ ", clusterId=" + connectionId.getServerId().getClusterId()
55+
+ '}';
5456
}
5557
}

driver-core/src/main/com/mongodb/event/ConnectionReadyEvent.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public ConnectionId getConnectionId() {
4949
@Override
5050
public String toString() {
5151
return "ConnectionReadyEvent{"
52-
+ " connectionId=" + connectionId
53-
+ '}';
52+
+ "connectionId=" + connectionId
53+
+ ", server=" + connectionId.getServerId().getAddress()
54+
+ ", clusterId=" + connectionId.getServerId().getClusterId()
55+
+ '}';
5456
}
5557
}

driver-core/src/main/com/mongodb/event/ConnectionRemovedEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ public Reason getReason() {
103103
public String toString() {
104104
return "ConnectionRemovedEvent{"
105105
+ "connectionId=" + connectionId
106+
+ ", server=" + connectionId.getServerId().getAddress()
107+
+ ", clusterId=" + connectionId.getServerId().getClusterId()
106108
+ ", reason=" + reason
107109
+ '}';
108110
}

driver-core/src/main/com/mongodb/event/ServerHeartbeatFailedEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public Throwable getThrowable() {
110110
public String toString() {
111111
return "ServerHeartbeatFailedEvent{"
112112
+ "connectionId=" + connectionId
113+
+ ", server=" + connectionId.getServerId().getAddress()
114+
+ ", clusterId=" + connectionId.getServerId().getClusterId()
113115
+ ", elapsedTimeNanos=" + elapsedTimeNanos
114116
+ ", awaited=" + awaited
115117
+ ", throwable=" + throwable

driver-core/src/main/com/mongodb/event/ServerHeartbeatStartedEvent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public ConnectionId getConnectionId() {
5050
public String toString() {
5151
return "ServerHeartbeatStartedEvent{"
5252
+ "connectionId=" + connectionId
53+
+ ", server=" + connectionId.getServerId().getAddress()
54+
+ ", clusterId=" + connectionId.getServerId().getClusterId()
5355
+ "} " + super.toString();
5456
}
5557
}

0 commit comments

Comments
 (0)