From aeff807bfe039528b34d9f08698f436301267c4d Mon Sep 17 00:00:00 2001
From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl>
Date: Tue, 10 Jan 2017 22:31:07 +0100
Subject: [PATCH] moar logging

---
 coolamqp/framing/compilation/content_property.py | 1 -
 coolamqp/uplink/connection/connection.py         | 8 ++++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/coolamqp/framing/compilation/content_property.py b/coolamqp/framing/compilation/content_property.py
index 4cdb877..3ebb60e 100644
--- a/coolamqp/framing/compilation/content_property.py
+++ b/coolamqp/framing/compilation/content_property.py
@@ -117,7 +117,6 @@ def _compile_particular_content_property_list_class(zpf, fields):
 
 def compile_particular_content_property_list_class(zpf, fields):
     q = _compile_particular_content_property_list_class(zpf, fields)
-    logger.debug('Compiling\n%s', q)
     loc = {}
     exec(q, globals(), loc)
     return loc['ParticularContentTypeList']
diff --git a/coolamqp/uplink/connection/connection.py b/coolamqp/uplink/connection/connection.py
index c192512..6d5b45c 100644
--- a/coolamqp/uplink/connection/connection.py
+++ b/coolamqp/uplink/connection/connection.py
@@ -84,6 +84,8 @@ class Connection(object):
 
     def on_connected(self):
         """Called by handshaker upon reception of final connection.open-ok"""
+        logger.info('Connection ready.')
+
         self.state = ST_ONLINE
 
         while len(self.callables_on_connected) > 0:
@@ -107,6 +109,8 @@ class Connection(object):
             else:
                 break
 
+        logger.info('Connected to broker, authentication in progress')
+
         sock.settimeout(0)
         sock.send(b'AMQP\x00\x00\x09\x01')
 
@@ -131,6 +135,8 @@ class Connection(object):
         and second time from ListenerThread when socket is disposed of
         Therefore we need to make sure callbacks are called EXACTLY once
         """
+        logger.info('Connection lost')
+
         self.state = ST_OFFLINE # Update state
 
         watchlists = [self.watches[channel] for channel in self.watches]
@@ -158,6 +164,8 @@ class Connection(object):
 
         if isinstance(payload, ConnectionClose):
             self.send([AMQPMethodFrame(0, ConnectionCloseOk())])
+            logger.info(u'Broker closed our connection - code %s reason %s', payload.reply_code, payload.reply_text.tobytes().decode('utf8'))
+
         elif isinstance(payload, ConnectionCloseOk):
             self.send(None)
 
-- 
GitLab