Bug 1275284 - Make debug log more readable. r=clokep a=jorgk
authoraleth <aleth@instantbird.org>
Wed, 28 Sep 2016 00:22:41 +0200
changeset 27606 277b70455f1441ccbada9d5bf4dde1c1e61e176b
parent 27605 a70dd73f2d13be7abbc4babe139c09a7f8ad6075
child 27607 8489c355f88d6fa7769138f513e191034dd6f395
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep, jorgk
bugs1275284
Bug 1275284 - Make debug log more readable. r=clokep a=jorgk
chat/protocols/twitter/twitter.js
--- a/chat/protocols/twitter/twitter.js
+++ b/chat/protocols/twitter/twitter.js
@@ -226,16 +226,18 @@ var GenericTwitterConversation = {
       if ("entities" in extended)
         entities = extended.entities;
     } else {
       // For non-retweets, we just want to use the entities that are given.
       if ("entities" in aTweet)
         entities = aTweet.entities;
     }
 
+    this._account.LOG("Tweet: " + text);
+
     if (Object.keys(entities).length) {
       /* entArray is an array of entities ready to be replaced in the tweet,
        * each entity contains:
        *  - start: the start index of the entity inside the tweet,
        *  - end: the end index of the entity inside the tweet,
        *  - str: the string that should be replaced inside the tweet,
        *  - href: the url (href attribute) of the created link tag,
        *  - [optional] text: the text to display for the link,
@@ -814,17 +816,20 @@ Account.prototype = {
     this.gotDisconnected(Ci.prplIAccount.ERROR_NETWORK_ERROR, aError);
   },
   onStreamTimeout: function() {
     this.gotDisconnected(Ci.prplIAccount.ERROR_NETWORK_ERROR, "timeout");
   },
   onDataAvailable: function(aRequest) {
     this.resetStreamTimeout();
     let newText = this._pendingData + aRequest.target.response;
-    this.DEBUG("Received data: " + newText);
+    if (newText.trim())
+      this.DEBUG("Received data: " + newText);
+    else
+      this.DEBUG("Received ping");
     let messages = newText.split(/\r\n?/);
     this._pendingData = messages.pop();
     for (let message of messages) {
       if (!message.trim())
         continue;
       let msg;
       try {
         msg = JSON.parse(message);