Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/neo4j/_async/io/_bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,12 +1029,23 @@ async def _set_defunct(self, message, error=None, silent=False):
direct_driver = getattr(self.pool, "is_direct_pool", False)
user_cancelled = isinstance(error, asyncio.CancelledError)

if not (user_cancelled or self._closing):
log_call = log.error
else:
log_call = log.debug
if error:
log.debug(
"[#%04X] _: <CONNECTION> error: %r", self.local_port, error
log_call(
"[#%04X] _: <CONNECTION> error: %s: %r",
self.local_port,
message,
error,
)
else:
log_call(
"[#%04X] _: <CONNECTION> error: %s",
self.local_port,
message,
)
if not user_cancelled:
log.error(message)
# We were attempting to receive data but the connection
# has unexpectedly terminated. So, we need to close the
# connection from the client side, and remove the address
Expand Down
19 changes: 15 additions & 4 deletions src/neo4j/_sync/io/_bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,12 +1029,23 @@ def _set_defunct(self, message, error=None, silent=False):
direct_driver = getattr(self.pool, "is_direct_pool", False)
user_cancelled = isinstance(error, asyncio.CancelledError)

if not (user_cancelled or self._closing):
log_call = log.error
else:
log_call = log.debug
if error:
log.debug(
"[#%04X] _: <CONNECTION> error: %r", self.local_port, error
log_call(
"[#%04X] _: <CONNECTION> error: %s: %r",
self.local_port,
message,
error,
)
else:
log_call(
"[#%04X] _: <CONNECTION> error: %s",
self.local_port,
message,
)
if not user_cancelled:
log.error(message)
# We were attempting to receive data but the connection
# has unexpectedly terminated. So, we need to close the
# connection from the client side, and remove the address
Expand Down