gawel / panoramisk

asyncio based library to play with asterisk
https://panoramisk.readthedocs.io/
MIT License
151 stars 50 forks source link

Messages Wrong Way Round? #109

Open ldo opened 2 years ago

ldo commented 2 years ago

Minor thing, but it seems to me that the message “not able to reconnect” should happen if there is already a connection, and “not able to connect” if there isn’t one, not vice versa.

diff --git a/panoramisk/manager.py b/panoramisk/manager.py
index 29e12ce..41c2032 100644
--- a/panoramisk/manager.py
+++ b/panoramisk/manager.py
@@ -65,10 +65,10 @@ class Manager:
             transport, protocol = f.result()
         except OSError:  # pragma: no cover
             if self._connected:
-                self.log.exception('Not able to connect')
+                self.log.warning('Not able to reconnect')
                 self._connected = False
             else:
-                self.log.warning('Not able to reconnect')
+                self.log.warning('Not able to connect')
             self.loop.call_later(self.reconnect_timeout, self.connect)
         else:
             self._connected = True

I made both warning-messages; do you want one or both to be exception instead?