Skip to content

Commit

Permalink
Cleanup debug logs, keep some useful ones
Browse files Browse the repository at this point in the history
  • Loading branch information
cderici committed Sep 21, 2023
1 parent 429d129 commit 178ca71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions juju/client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ async def close(self, to_reconnect=False):
self._debug_log_task.cancel()

if self._ws and not self._ws.closed:
log.debug('close: calling websocket.close()')
await self._ws.close()

if not to_reconnect:
Expand All @@ -465,7 +464,6 @@ async def close(self, to_reconnect=False):
pass
except websockets.exceptions.ConnectionClosed:
pass
log.debug('close: all tasks are done')

self._pinger_task = None
self._receiver_task = None
Expand Down Expand Up @@ -598,7 +596,6 @@ async def _receiver(self):
raise

async def _pinger(self):
log.warning('Pinger: Starting')
'''
A Controller can time us out if we are silent for too long. This
is especially true in JaaS, which has a fairly strict timeout.
Expand Down Expand Up @@ -802,7 +799,7 @@ async def reconnect(self):
if not self.is_debug_log_connection:
self._build_facades(res.get('facades', {}))
if not self._pinger_task:
log.debug('reconnect: creating pinger task')
log.debug('reconnect: scheduling a pinger task')
self._pinger_task = jasyncio.create_task(self._pinger(), name="Task_Pinger")

async def _connect(self, endpoints):
Expand Down Expand Up @@ -859,7 +856,7 @@ async def _try_endpoint(endpoint, cacert, delay):
# If this is regular connection, and we dont have a
# receiver_task yet, then schedule a _receiver_task
elif not self.is_debug_log_connection and not self._receiver_task:
log.debug('_connect: creating receiver task')
log.debug('_connect: scheduling a receiver task')
self._receiver_task = jasyncio.create_task(self._receiver(), name="Task_Receiver")

log.debug("Driver connected to juju %s", self.addr)
Expand Down Expand Up @@ -915,7 +912,7 @@ async def _connect_with_redirect(self, endpoints):
login_result = await self._connect_with_login(e.endpoints)
self._build_facades(login_result.get('facades', {}))
if not self._pinger_task:
log.debug('_connect_with_redirect: creating pinger task')
log.debug('_connect_with_redirect: scheduling a pinger task')
self._pinger_task = jasyncio.create_task(self._pinger(), name="Task_Pinger")

# _build_facades takes the facade list that comes from the connection with the controller,
Expand Down
2 changes: 1 addition & 1 deletion juju/client/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def disconnect(self, entity):
"""Shut down the watcher task and close websockets.
"""
if self._connection:
log.debug(f'Closing {entity} connection')
log.debug(f'Connector: closing {entity} connection')
await self._connection.close()
self._connection = None
if self._log_connection:
Expand Down

0 comments on commit 178ca71

Please sign in to comment.