Bug 1275284 - Make debug log more readable. r=clokep
authoraleth <aleth@instantbird.org>
Wed, 28 Sep 2016 00:22:41 +0200
changeset 25691 75e7b63716981dfdb764f36dc83fd2fbb28ff3ee
parent 25690 d4134a1be965e2c002454d4341f2a89098c7dc43
child 25692 88269bbc6b03fc3e7defef871713527f5cb96922
push id1744
push useraleth@instantbird.org
push dateSun, 16 Oct 2016 20:14:08 +0000
treeherdercomm-beta@88269bbc6b03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep
bugs1275284
Bug 1275284 - Make debug log more readable. r=clokep
chat/protocols/twitter/twitter.js
--- a/chat/protocols/twitter/twitter.js
+++ b/chat/protocols/twitter/twitter.js
@@ -300,16 +300,18 @@ Conversation.prototype = {
       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,
@@ -756,17 +758,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);