Improve logging.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 30 Sep 2020 18:08:50 +0000 (20:08 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 30 Sep 2020 18:08:50 +0000 (20:08 +0200)
lagarde.py

index c31a45a98958f760620b85f5a5f2b44c52fe9e6e..b8295953999531d93264eb07cd6333502800dd0b 100755 (executable)
@@ -58,14 +58,14 @@ class Lagarde:
         self.webrtcbin = None
 
     def on_negotiation_needed(self, element):
-        log.debug('on_negotiation_needed')
+        log.info('on_negotiation_needed')
 
     def on_ice_candidate(self, element, mlineindex, candidate):
-        log.debug('on_ice_candidate')
+        log.info('on_ice_candidate')
         self.generated_ice_candidates.put_nowait((mlineindex, candidate))
 
     def webrtcbin_pad_added(self, element, pad):
-        log.debug('webrtcbin_pad_added')
+        log.info('webrtcbin_pad_added')
         if pad.direction != Gst.PadDirection.SRC:
             return
         decodebin = Gst.ElementFactory.make('decodebin')
@@ -75,9 +75,9 @@ class Lagarde:
         self.webrtcbin.link(decodebin)
 
     def decodebin_pad_added(self, element, pad):
-        log.debug('decodebin_pad_added')
+        log.info('decodebin_pad_added')
         if not pad.has_current_caps():
-            log.debug(pad, 'has no caps, ignoring')
+            log.info(pad, 'has no caps, ignoring')
             return
 
         caps = pad.get_current_caps()
@@ -141,7 +141,8 @@ class Lagarde:
                     self.mids = [sdp_message.get_media(i).get_attribute_val('mid')
                                           for i in range(sdp_message.medias_len())]
                     sdp_answer = sdp_message.as_text()
-                    log.info(f'Send SDP answer:\n{sdp_answer}')
+                    log.info(f'Send SDP answer')
+                    log.debug(f'SDP answer:\n{sdp_answer}')
                     sdp_answer_msg = json.dumps({
                         'SessionID': self.session_id,
                         'Type': "gotAnswer",
@@ -174,7 +175,8 @@ class Lagarde:
                         'Type': 'addCalleeIceCandidate',
                         'Value': icemsg_value,
                     })
-                    log.info(f'Send ICE candidate: {icemsg_value}')
+                    log.info(f'Send ICE candidate')
+                    log.debug(f'ICE candidate: {icemsg_value}')
                     await self.websocket.send(icemsg)
 
                 else:
@@ -195,11 +197,13 @@ class Lagarde:
                 elif msg_type == 'gotOffer':
                     value_json = json.loads(msg_value)
                     sdp = value_json['sdp']
-                    log.info(f'Got SDP offer:\n{sdp}')
+                    log.info(f'Got SDP offer')
+                    log.debug(f'SDP offer:\n{sdp}')
                     self.sdp_offer = sdp
                 elif msg_type == 'addCallerIceCandidate':
                     value_json = json.loads(msg_value)
-                    log.info(f'Got ICE candidate: {value_json}')
+                    log.info(f'Got ICE candidate')
+                    log.debug(f'ICE candidate: {value_json}')
                     self.received_ice_candidates.put_nowait(value_json)
                 elif msg_type == 'roomNotFound':
                     log.error(f'The room was not found: {uri}')