Skip to content

Commit 73ff3d6

Browse files
committed
update logging test
1 parent 02aec91 commit 73ff3d6

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

pymongo/asynchronous/pool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,10 +1061,11 @@ def backoff(self):
10611061
if self.enabled_for_logging and _CONNECTION_LOGGER.isEnabledFor(logging.DEBUG):
10621062
_debug_log(
10631063
_CONNECTION_LOGGER,
1064-
message=_ConnectionStatusMessage.POOL_BACKOFF % backoff_duration_ms,
1064+
message=_ConnectionStatusMessage.POOL_BACKOFF,
10651065
clientId=self._client_id,
10661066
serverHost=self.address[0],
10671067
serverPort=self.address[1],
1068+
durationMS=backoff_duration_ms,
10681069
reason=_verbose_connection_error_reason(ConnectionClosedReason.POOL_BACKOFF),
10691070
error=ConnectionClosedReason.POOL_BACKOFF,
10701071
)

pymongo/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _ConnectionStatusMessage(str, enum.Enum):
4242
POOL_READY = "Connection pool ready"
4343
POOL_CLOSED = "Connection pool closed"
4444
POOL_CLEARED = "Connection pool cleared"
45-
POOL_BACKOFF = "Connection pool backoff %sms"
45+
POOL_BACKOFF = "Connection pool backoff"
4646

4747
CONN_CREATED = "Connection created"
4848
CONN_READY = "Connection ready"

pymongo/synchronous/pool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1057,10 +1057,11 @@ def backoff(self):
10571057
if self.enabled_for_logging and _CONNECTION_LOGGER.isEnabledFor(logging.DEBUG):
10581058
_debug_log(
10591059
_CONNECTION_LOGGER,
1060-
message=_ConnectionStatusMessage.POOL_BACKOFF % backoff_duration_ms,
1060+
message=_ConnectionStatusMessage.POOL_BACKOFF,
10611061
clientId=self._client_id,
10621062
serverHost=self.address[0],
10631063
serverPort=self.address[1],
1064+
durationMS=backoff_duration_ms,
10641065
reason=_verbose_connection_error_reason(ConnectionClosedReason.POOL_BACKOFF),
10651066
error=ConnectionClosedReason.POOL_BACKOFF,
10661067
)

test/connection_logging/connection-logging.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,13 @@
691691
"level": "debug",
692692
"component": "connection",
693693
"data": {
694-
"message": "Connection pool backoff attempt number 1",
694+
"message": "Connection pool backoff",
695695
"serverHost": {
696696
"$$type": "string"
697697
},
698+
"durationMS": {
699+
"$$type": "int"
700+
},
698701
"serverPort": {
699702
"$$type": [
700703
"int",

0 commit comments

Comments
 (0)