Przeglądaj źródła

fix(logger): Logging enhancements.

Get rid of noisy logs related to SDP transformations which are redundant. Fix formatting and add missing information.
tags/v0.0.2
Jaya Allamsetty 4 lat temu
rodzic
commit
17f968fdea

+ 5
- 17
modules/RTC/TraceablePeerConnection.js Wyświetl plik

@@ -901,7 +901,7 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track, tr
901 901
         return;
902 902
     }
903 903
 
904
-    logger.log(`${this} associated ssrc`, ownerEndpointId, trackSsrc);
904
+    logger.log(`${this} associated ssrc:${trackSsrc} to endpoint:${ownerEndpointId}`);
905 905
 
906 906
     const peerMediaInfo
907 907
         = this.signalingLayer.getPeerMediaInfo(ownerEndpointId, mediaType);
@@ -2901,23 +2901,11 @@ TraceablePeerConnection.prototype._processLocalSSRCsMap = function(ssrcMap) {
2901 2901
 
2902 2902
             // eslint-disable-next-line no-negated-condition
2903 2903
             if (newSSRCNum !== oldSSRCNum) {
2904
-                if (oldSSRCNum === null) {
2905
-                    logger.info(
2906
-                        `Storing new local SSRC for ${track} in ${this}`,
2907
-                        newSSRC);
2908
-                } else {
2909
-                    logger.error(
2910
-                        `Overwriting SSRC for ${track} ${trackMSID} in ${this
2911
-                        } with: `, newSSRC);
2904
+                if (!oldSSRCNum) {
2905
+                    logger.error(`Overwriting SSRC for ${track} ${trackMSID} in ${this} with: `, newSSRC);
2912 2906
                 }
2913 2907
                 this.localSSRCs.set(track.rtcId, newSSRC);
2914
-
2915
-                this.eventEmitter.emit(
2916
-                    RTCEvents.LOCAL_TRACK_SSRC_UPDATED, track, newSSRCNum);
2917
-            } else {
2918
-                logger.debug(
2919
-                    `The local SSRC(${newSSRCNum}) for ${track} ${trackMSID}`
2920
-                     + `is still up to date in ${this}`);
2908
+                this.eventEmitter.emit(RTCEvents.LOCAL_TRACK_SSRC_UPDATED, track, newSSRCNum);
2921 2909
             }
2922 2910
         } else if (!track.isVideoTrack() && !track.isMuted()) {
2923 2911
             // It is normal to find no SSRCs for a muted video track in
@@ -3033,5 +3021,5 @@ TraceablePeerConnection.prototype.generateNewStreamSSRCInfo = function(track) {
3033 3021
  * @return {string}
3034 3022
  */
3035 3023
 TraceablePeerConnection.prototype.toString = function() {
3036
-    return `TPC[${this.id},p2p:${this.isP2P}]`;
3024
+    return `TPC[${this.id},${this.isP2P ? 'P2P' : 'JVB'}]`;
3037 3025
 };

+ 0
- 1
modules/connectivity/ParticipantConnectionStatus.js Wyświetl plik

@@ -612,7 +612,6 @@ export default class ParticipantConnectionStatusHandler {
612 612
         if (typeof isConnActiveByJvb !== 'boolean') {
613 613
             // If no status was received from the JVB it means that it's active
614 614
             // (the bridge does not send notification unless there is a problem)
615
-            logger.debug('Assuming connection active by JVB - no notification');
616 615
             isConnActiveByJvb = true;
617 616
         }
618 617
 

+ 1
- 5
modules/e2ee/E2EEncryption.js Wyświetl plik

@@ -205,9 +205,7 @@ export class E2EEncryption {
205 205
      * Advances (using ratcheting) the current key when a new participant joins the conference.
206 206
      * @private
207 207
      */
208
-    _onParticipantJoined(id) {
209
-        logger.debug(`Participant ${id} joined`);
210
-
208
+    _onParticipantJoined() {
211 209
         if (this._conferenceJoined && this._enabled) {
212 210
             this._ratchetKey();
213 211
         }
@@ -218,8 +216,6 @@ export class E2EEncryption {
218 216
      * @private
219 217
      */
220 218
     _onParticipantLeft(id) {
221
-        logger.debug(`Participant ${id} left`);
222
-
223 219
         this._e2eeCtx.cleanup(id);
224 220
 
225 221
         if (this._enabled) {

+ 1
- 14
modules/sdp/LocalSdpMunger.js Wyświetl plik

@@ -77,12 +77,6 @@ export default class LocalSdpMunger {
77 77
                 = mediaStream && this.tpc.isMediaStreamInPc(mediaStream);
78 78
             const shouldFakeSdp = muted || !isInPeerConnection;
79 79
 
80
-            logger.debug(
81
-                `${this.tpc} ${videoTrack} muted: ${
82
-                    muted}, is in PeerConnection: ${
83
-                    isInPeerConnection} => should fake sdp ? : ${
84
-                    shouldFakeSdp}`);
85
-
86 80
             if (!shouldFakeSdp) {
87 81
                 continue; // eslint-disable-line no-continue
88 82
             }
@@ -94,8 +88,7 @@ export default class LocalSdpMunger {
94 88
                     : [ this.tpc.sdpConsistency.cachedPrimarySsrc ];
95 89
 
96 90
             if (!requiredSSRCs.length) {
97
-                logger.error(
98
-                    `No SSRCs stored for: ${videoTrack} in ${this.tpc}`);
91
+                logger.error(`No SSRCs stored for: ${videoTrack} in ${this.tpc}`);
99 92
 
100 93
                 continue; // eslint-disable-line no-continue
101 94
             }
@@ -122,9 +115,6 @@ export default class LocalSdpMunger {
122 115
                 videoMLine.removeSSRC(ssrcNum);
123 116
 
124 117
                 // Inject
125
-                logger.debug(
126
-                    `${this.tpc} injecting video SSRC: ${ssrcNum} for ${
127
-                        videoTrack}`);
128 118
                 videoMLine.addSSRCAttribute({
129 119
                     id: ssrcNum,
130 120
                     attribute: 'cname',
@@ -144,9 +134,6 @@ export default class LocalSdpMunger {
144 134
 
145 135
                 if (!videoMLine.findGroup(group.semantics, group.ssrcs)) {
146 136
                     // Inject the group
147
-                    logger.debug(
148
-                        `${this.tpc} injecting SIM group for ${videoTrack}`,
149
-                        group);
150 137
                     videoMLine.addSSRCGroup(group);
151 138
                 }
152 139
             }

+ 1
- 34
modules/sdp/RtxModifier.js Wyświetl plik

@@ -21,9 +21,6 @@ const logger = getLogger(__filename);
21 21
  * @param {number} rtxSsrc the rtx ssrc to associate with the primary ssrc
22 22
  */
23 23
 function updateAssociatedRtxStream(mLine, primarySsrcInfo, rtxSsrc) {
24
-    logger.debug(
25
-        `Updating mline to associate ${rtxSsrc} `
26
-        + `rtx ssrc with primary stream, ${primarySsrcInfo.id}`);
27 24
     const primarySsrc = primarySsrcInfo.id;
28 25
     const primarySsrcMsid = primarySsrcInfo.msid;
29 26
     const primarySsrcCname = primarySsrcInfo.cname;
@@ -31,22 +28,12 @@ function updateAssociatedRtxStream(mLine, primarySsrcInfo, rtxSsrc) {
31 28
     const previousRtxSSRC = mLine.getRtxSSRC(primarySsrc);
32 29
 
33 30
     if (previousRtxSSRC === rtxSsrc) {
34
-        logger.debug(`${rtxSsrc} was already associated with ${primarySsrc}`);
35
-
36 31
         return;
37 32
     }
38 33
     if (previousRtxSSRC) {
39
-        logger.debug(
40
-            `${primarySsrc} was previously associated with rtx `
41
-            + `${previousRtxSSRC}, removing all references to it`);
42
-
43 34
         // Stream already had an rtx ssrc that is different than the one given,
44 35
         //  remove all trace of the old one
45 36
         mLine.removeSSRC(previousRtxSSRC);
46
-
47
-        logger.debug(`groups before filtering for ${previousRtxSSRC}`);
48
-        logger.debug(mLine.dumpSSRCGroups());
49
-
50 37
         mLine.removeGroupsWithSSRC(previousRtxSSRC);
51 38
     }
52 39
     mLine.addSSRCAttribute({
@@ -135,50 +122,30 @@ export default class RtxModifier {
135 122
      */
136 123
     modifyRtxSsrcs2(videoMLine) {
137 124
         if (videoMLine.direction === 'recvonly') {
138
-            logger.debug('RtxModifier doing nothing, video m line is recvonly');
139 125
 
140 126
             return false;
141 127
         }
142 128
         if (videoMLine.getSSRCCount() < 1) {
143
-            logger.debug('RtxModifier doing nothing, no video ssrcs present');
144 129
 
145 130
             return false;
146 131
         }
147
-        logger.debug('Current ssrc mapping: ', this.correspondingRtxSsrcs);
148 132
         const primaryVideoSsrcs = videoMLine.getPrimaryVideoSSRCs();
149 133
 
150
-        logger.debug('Parsed primary video ssrcs ', primaryVideoSsrcs,
151
-            ' making sure all have rtx streams');
152 134
         for (const ssrc of primaryVideoSsrcs) {
153 135
             const msid = videoMLine.getSSRCAttrValue(ssrc, 'msid');
154 136
             const cname = videoMLine.getSSRCAttrValue(ssrc, 'cname');
155 137
             let correspondingRtxSsrc = this.correspondingRtxSsrcs.get(ssrc);
156 138
 
157
-            if (correspondingRtxSsrc) {
158
-                logger.debug(
159
-                    'Already have an associated rtx ssrc for '
160
-                    + `video ssrc ${ssrc}: ${correspondingRtxSsrc}`);
161
-            } else {
162
-                logger.debug(
163
-                    `No previously associated rtx ssrc for video ssrc ${ssrc}`);
164
-
139
+            if (!correspondingRtxSsrc) {
165 140
                 // If there's one in the sdp already for it, we'll just set
166 141
                 //  that as the corresponding one
167 142
                 const previousAssociatedRtxStream = videoMLine.getRtxSSRC(ssrc);
168 143
 
169 144
                 if (previousAssociatedRtxStream) {
170
-                    logger.debug(
171
-                        `Rtx stream ${previousAssociatedRtxStream} `
172
-                        + 'already existed in the sdp as an rtx stream for '
173
-                        + `${ssrc}`);
174 145
                     correspondingRtxSsrc = previousAssociatedRtxStream;
175 146
                 } else {
176 147
                     correspondingRtxSsrc = SDPUtil.generateSsrc();
177
-                    logger.debug(`Generated rtx ssrc ${correspondingRtxSsrc} `
178
-                                 + `for ssrc ${ssrc}`);
179 148
                 }
180
-                logger.debug(`Caching rtx ssrc ${correspondingRtxSsrc} `
181
-                             + `for video ssrc ${ssrc}`);
182 149
                 this.correspondingRtxSsrcs.set(ssrc, correspondingRtxSsrc);
183 150
             }
184 151
             updateAssociatedRtxStream(

+ 3
- 17
modules/sdp/SdpConsistency.js Wyświetl plik

@@ -77,9 +77,7 @@ export default class SdpConsistency {
77 77
         const videoMLine = sdpTransformer.selectMedia('video');
78 78
 
79 79
         if (!videoMLine) {
80
-            logger.debug(
81
-                `${this.logPrefix} no 'video' media found in the sdp: `
82
-                    + `${sdpStr}`);
80
+            logger.debug(`${this.logPrefix} no 'video' media found in the sdp: ${sdpStr}`);
83 81
 
84 82
             return sdpStr;
85 83
         }
@@ -94,25 +92,17 @@ export default class SdpConsistency {
94 92
                     value: `recvonly-${this.cachedPrimarySsrc}`
95 93
                 });
96 94
             } else {
97
-                logger.info(
98
-                    `${this.logPrefix} no SSRC found for the recvonly video`
99
-                        + 'stream!');
95
+                logger.info(`${this.logPrefix} no SSRC found for the recvonly video stream!`);
100 96
             }
101 97
         } else {
102 98
             const newPrimarySsrc = videoMLine.getPrimaryVideoSsrc();
103 99
 
104 100
             if (!newPrimarySsrc) {
105
-                logger.info(
106
-                    `${this.logPrefix} sdp-consistency couldn't`
107
-                        + ' parse new primary ssrc');
101
+                logger.info(`${this.logPrefix} sdp-consistency couldn't parse new primary ssrc`);
108 102
 
109 103
                 return sdpStr;
110 104
             }
111 105
             if (this.cachedPrimarySsrc) {
112
-                logger.info(
113
-                    `${this.logPrefix} sdp-consistency replacing new ssrc`
114
-                        + `${newPrimarySsrc} with cached `
115
-                        + `${this.cachedPrimarySsrc}`);
116 106
                 videoMLine.replaceSSRC(newPrimarySsrc, this.cachedPrimarySsrc);
117 107
                 for (const group of videoMLine.ssrcGroups) {
118 108
                     if (group.semantics === 'FID') {
@@ -128,11 +118,7 @@ export default class SdpConsistency {
128 118
                 }
129 119
             } else {
130 120
                 this.cachedPrimarySsrc = newPrimarySsrc;
131
-                logger.info(
132
-                    `${this.logPrefix} sdp-consistency caching primary ssrc`
133
-                        + `${this.cachedPrimarySsrc}`);
134 121
             }
135
-
136 122
             this.injectRecvOnly = true;
137 123
         }
138 124
 

+ 13
- 34
modules/xmpp/JingleSessionPC.js Wyświetl plik

@@ -453,10 +453,7 @@ export default class JingleSessionPC extends JingleSession {
453 453
                     `ice.state.${this.peerconnection.iceConnectionState}`]
454 454
                     = now;
455 455
             }
456
-            logger.log(
457
-                `(TIME) ICE ${this.peerconnection.iceConnectionState}`
458
-                    + ` P2P? ${this.isP2P}:\t`,
459
-                now);
456
+            logger.log(`(TIME) ICE ${this.peerconnection.iceConnectionState} ${this.isP2P ? 'P2P' : 'JVB'}:\t`, now);
460 457
 
461 458
             Statistics.sendAnalytics(
462 459
                 ICE_STATE_CHANGED,
@@ -793,8 +790,7 @@ export default class JingleSessionPC extends JingleSession {
793 790
             });
794 791
 
795 792
         if (!iceCandidates.length) {
796
-            logger.error(
797
-                'No ICE candidates to add ?', elem[0] && elem[0].outerHTML);
793
+            logger.error('No ICE candidates to add ?', elem[0] && elem[0].outerHTML);
798 794
 
799 795
             return;
800 796
         }
@@ -815,8 +811,7 @@ export default class JingleSessionPC extends JingleSession {
815 811
             logger.debug(`ICE candidates task finished on ${this}`);
816 812
         };
817 813
 
818
-        logger.debug(
819
-            `Queued add (${iceCandidates.length}) ICE candidates task...`);
814
+        logger.debug(`Queued add (${iceCandidates.length}) ICE candidates task...`);
820 815
         this.modificationQueue.push(workFunction);
821 816
     }
822 817
 
@@ -845,9 +840,7 @@ export default class JingleSessionPC extends JingleSession {
845 840
 
846 841
                         if (owner && owner.length) {
847 842
                             if (isNaN(ssrc) || ssrc < 0) {
848
-                                logger.warn(
849
-                                    `Invalid SSRC ${ssrc} value received`
850
-                                        + ` for ${owner}`);
843
+                                logger.warn(`Invalid SSRC ${ssrc} value received for ${owner}`);
851 844
                             } else {
852 845
                                 this.signalingLayer.setSSRCOwner(
853 846
                                     ssrc,
@@ -868,8 +861,7 @@ export default class JingleSessionPC extends JingleSession {
868 861
         if (this.peerconnection) {
869 862
             this.peerconnection.generateRecvonlySsrc();
870 863
         } else {
871
-            logger.error(
872
-                'Unable to generate recvonly SSRC - no peerconnection');
864
+            logger.error('Unable to generate recvonly SSRC - no peerconnection');
873 865
         }
874 866
     }
875 867
 
@@ -1617,8 +1609,7 @@ export default class JingleSessionPC extends JingleSession {
1617 1609
                 const ssrc = $(this).attr('ssrc');
1618 1610
 
1619 1611
                 if (currentRemoteSdp.containsSSRC(ssrc)) {
1620
-                    logger.warn(
1621
-                        `Source-add request for existing SSRC: ${ssrc}`);
1612
+                    logger.warn(`Source-add request for existing SSRC: ${ssrc}`);
1622 1613
 
1623 1614
                     return;
1624 1615
                 }
@@ -1739,12 +1730,8 @@ export default class JingleSessionPC extends JingleSession {
1739 1730
             }
1740 1731
 
1741 1732
             logger.log(`Processing ${logPrefix}`);
1742
-            logger.log(
1743
-                'ICE connection state: ',
1744
-                this.peerconnection.iceConnectionState);
1745 1733
 
1746
-            const oldLocalSdp
1747
-                = new SDP(this.peerconnection.localDescription.sdp);
1734
+            const oldLocalSdp = new SDP(this.peerconnection.localDescription.sdp);
1748 1735
             const sdp = new SDP(this.peerconnection.remoteDescription.sdp);
1749 1736
             const addOrRemoveSsrcInfo
1750 1737
                 = isAdd
@@ -1760,8 +1747,7 @@ export default class JingleSessionPC extends JingleSession {
1760 1747
                     const newLocalSdp
1761 1748
                         = new SDP(this.peerconnection.localDescription.sdp);
1762 1749
 
1763
-                    logger.log(
1764
-                        `${logPrefix} - OK, SDPs: `, oldLocalSdp, newLocalSdp);
1750
+                    logger.log(`${logPrefix} - OK`);
1765 1751
                     this.notifyMySSRCUpdate(oldLocalSdp, newLocalSdp);
1766 1752
                     finishedCallback();
1767 1753
                 }, error => {
@@ -1940,8 +1926,7 @@ export default class JingleSessionPC extends JingleSession {
1940 1926
 
1941 1927
                 return this.peerconnection.setLocalDescription(offer)
1942 1928
                     .then(() => {
1943
-                        logger.debug(
1944
-                            'Renegotiate: setting remote description');
1929
+                        logger.debug('Renegotiate: setting remote description');
1945 1930
 
1946 1931
                         // eslint-disable-next-line max-len
1947 1932
                         return this.peerconnection.setRemoteDescription(remoteDescription);
@@ -2154,9 +2139,7 @@ export default class JingleSessionPC extends JingleSession {
2154 2139
         const addedMedia = sdpDiff.getNewMedia();
2155 2140
 
2156 2141
         if (Object.keys(addedMedia).length) {
2157
-            logger.error(
2158
-                `${this} - some SSRC were added on ${operationName}`,
2159
-                addedMedia);
2142
+            logger.error(`${this} - some SSRC were added on ${operationName}`, addedMedia);
2160 2143
 
2161 2144
             return false;
2162 2145
         }
@@ -2165,9 +2148,7 @@ export default class JingleSessionPC extends JingleSession {
2165 2148
         const removedMedia = sdpDiff.getNewMedia();
2166 2149
 
2167 2150
         if (Object.keys(removedMedia).length) {
2168
-            logger.error(
2169
-                `${this} - some SSRCs were removed on ${operationName}`,
2170
-                removedMedia);
2151
+            logger.error(`${this} - some SSRCs were removed on ${operationName}`, removedMedia);
2171 2152
 
2172 2153
             return false;
2173 2154
         }
@@ -2432,8 +2413,7 @@ export default class JingleSessionPC extends JingleSession {
2432 2413
                 || (remoteVideoSenders === 'responder' && !this.isInitiator);
2433 2414
 
2434 2415
         if (isRemoteVideoActive !== this._remoteVideoActive) {
2435
-            logger.debug(
2436
-                `${this} new remote video active: ${isRemoteVideoActive}`);
2416
+            logger.debug(`${this} new remote video active: ${isRemoteVideoActive}`);
2437 2417
             this._remoteVideoActive = isRemoteVideoActive;
2438 2418
         }
2439 2419
 
@@ -2627,8 +2607,7 @@ export default class JingleSessionPC extends JingleSession {
2627 2607
      * @return {string}
2628 2608
      */
2629 2609
     toString() {
2630
-        return `JingleSessionPC[p2p=${this.isP2P},`
2631
-                    + `initiator=${this.isInitiator},sid=${this.sid}]`;
2610
+        return `JingleSessionPC[${this.isP2P ? 'P2P' : 'JVB'},initiator=${this.isInitiator},sid=${this.sid}]`;
2632 2611
     }
2633 2612
 
2634 2613
     /**

+ 1
- 1
modules/xmpp/strophe.jingle.js Wyświetl plik

@@ -71,7 +71,7 @@ export default class JingleConnectionPlugin extends ConnectionPlugin {
71 71
             id: iq.getAttribute('id')
72 72
         });
73 73
 
74
-        logger.log(`on jingle ${action} from ${fromJid}`, iq);
74
+        logger.log(`on jingle ${action} from ${fromJid}`, JSON.stringify(iq));
75 75
         let sess = this.sessions[sid];
76 76
 
77 77
         if (action !== 'session-initiate') {

Ładowanie…
Anuluj
Zapisz