Bladeren bron

add logging

j8
Philipp Hancke 11 jaren geleden
bovenliggende
commit
667551c7a0
5 gewijzigde bestanden met toevoegingen van 171 en 12 verwijderingen
  1. 24
    3
      app.js
  2. 0
    7
      estos_log.js
  3. 0
    1
      index.html
  4. 1
    1
      libs/colibri.js
  5. 146
    0
      libs/strophejingle.bundle.js

+ 24
- 3
app.js Bestand weergeven

@@ -361,9 +361,30 @@ $(window).bind('unload', function () {
361 361
     }
362 362
 });
363 363
 
364
-/*
365
- * Appends the given message to the chat conversation.
366
- */
364
+// <a onclick="dump(event.target);">my download button</a>
365
+function dump(elem, filename){
366
+    elem.download = filename || 'xmpplog.json';
367
+    elem.href = 'data:application/json;charset=utf-8,\n';
368
+    var data = {};
369
+    data.time = new Date();
370
+    data.url = window.location.href;
371
+    data.ua = navigator.userAgent;
372
+    if (connection.logger) {
373
+        data.xmpp = connection.logger.log;
374
+    }
375
+    if (connection.jingle) {
376
+        Object.keys(connection.jingle.sessions).forEach(function (sid) {
377
+            var session = connection.jingle.sessions[sid];
378
+            if (session.peerconnection && session.peerconnection.updateLog) {
379
+                // FIXME: should probably be a .dump call
380
+                data["jingle_" + session.sid] = session.peerconnection.updateLog;
381
+            }
382
+        });
383
+    }
384
+    elem.href += encodeURIComponent(JSON.stringify(data, null, '  '));
385
+    return false;
386
+}
387
+
367 388
 function updateChatConversation(nick, message)
368 389
 {
369 390
     var divClassName = '';

+ 0
- 7
estos_log.js Bestand weergeven

@@ -13,11 +13,4 @@ Strophe.addConnectionPlugin('logger', {
13 13
     log_outgoing: function (stanza) {
14 14
         this.log.push([new Date().getTime(), 'outgoing', stanza]);
15 15
     },
16
-    // <a onclick="connection.logger.dump(event.target);">my download button</a>
17
-    dump: function (what, filename){
18
-        what.download = filename || 'xmpplog.json';
19
-        what.href = 'data:application/json;charset=utf-8,\n';
20
-        what.href += encodeURIComponent(JSON.stringify(this.log, null, '  '));
21
-        return true;
22
-    }
23 16
 });

+ 0
- 1
index.html Bestand weergeven

@@ -29,7 +29,6 @@
29 29
             <a class="button" onclick="openLinkDialog();"><i title="Invite others" class="fa fa-link fa-lg"></i></a>
30 30
             <div class="header_button_separator"></div>
31 31
             <a class="button" onclick='openChat();'><i id="chat" title="Open chat" class="fa fa-comments fa-lg"></i></a>
32
- <!--i class='fa fa-external-link'>&nbsp;</i>Others can join you by just going to <span id='roomurl'></span-->
33 32
         </div>
34 33
     </div>
35 34
     <div id="settings">

+ 1
- 1
libs/colibri.js Bestand weergeven

@@ -72,7 +72,7 @@ ColibriFocus.prototype.makeConference = function (peers) {
72 72
         ob.channels.push([]);
73 73
     });
74 74
 
75
-    this.peerconnection = new RTC.peerconnection(this.connection.jingle.ice_config, this.connection.jingle.pc_constraints);
75
+    this.peerconnection = new TraceablePeerConnection(this.connection.jingle.ice_config, this.connection.jingle.pc_constraints);
76 76
     this.peerconnection.addStream(this.connection.jingle.localStream);
77 77
     this.peerconnection.oniceconnectionstatechange = function (event) {
78 78
         console.warn('ice connection state changed to', ob.peerconnection.iceConnectionState);

+ 146
- 0
libs/strophejingle.bundle.js
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


Laden…
Annuleren
Opslaan