[Libreoffice-commits] online.git: loolwsd/LOOLBroker.cpp loolwsd/LOOLKit.cpp loolwsd/MasterProcessSession.cpp loolwsd/Util.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Mar 14 03:04:35 UTC 2016


 loolwsd/LOOLBroker.cpp           |    3 ++-
 loolwsd/LOOLKit.cpp              |   14 ++++++++------
 loolwsd/MasterProcessSession.cpp |    6 +++---
 loolwsd/Util.cpp                 |    2 +-
 4 files changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 0d8fcf5699ec243cf999c659592b64ff3e20f690
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri Mar 11 17:25:44 2016 -0500

    loolwsd: logging
    
    Change-Id: I9a4dc248aca87983e3d7d3ace0071e5bbf92e688
    Reviewed-on: https://gerrit.libreoffice.org/23209
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index fa5ef56..aedd8f7 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -233,6 +233,7 @@ public:
             return -1;
         }
 
+        Log::debug("Recv child response: [" + response + "].");
         return bytes;
     }
 
@@ -369,7 +370,7 @@ public:
         Log::debug("Thread [" + thread_name + "] started.");
 
         Util::pollPipeForReading(pollPipeBroker, FIFO_LOOLWSD, readerBroker,
-                                 [this](std::string& message) {return handleInput(message); } );
+                                 [this](std::string& message) { return handleInput(message); } );
 
         Log::debug("Thread [" + thread_name + "] finished.");
     }
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 9ac2dc8..59f526d 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -415,7 +415,7 @@ public:
                        [this](const std::string& id, const std::string& uri, const std::string& docPassword, bool isDocPasswordProvided) { return onLoad(id, uri, docPassword, isDocPasswordProvided); },
                        [this](const std::string& id) { onUnload(id); });
         // child -> 0,  sessionId -> 1, PID -> 2
-        std::string hello("child " + sessionId + " " + std::to_string(Process::id()));
+        const std::string hello("child " + sessionId + " " + std::to_string(Process::id()));
         session->sendTextFrame(hello);
 
         auto thread = std::make_shared<Connection>(session, ws);
@@ -479,7 +479,9 @@ public:
     /// Set Document password for given URL
     void setDocumentPassword(int nPasswordType)
     {
-        Log::info("setDocumentPassword: passwordProtected=" + std::to_string(_isDocPasswordProtected) + " passwordProvided=" + std::to_string(_isDocPasswordProvided) + " password='" + _docPassword + "'");
+        Log::info() << "setDocumentPassword: passwordProtected=" << _isDocPasswordProtected
+                    << " passwordProvided=" << _isDocPasswordProvided
+                    << " password='" << _docPassword <<  "'" << Log::end;
 
         if (_isDocPasswordProtected && _isDocPasswordProvided)
         {
@@ -768,7 +770,7 @@ void lokit_main(const std::string& childRoot,
     struct pollfd pollPipeBroker;
     ssize_t bytes = -1;
     int   ready = 0;
-    bool  isDirtyKit = false;
+    bool  isUsedKit = false;
     char  buffer[READ_BUFFER_SIZE];
     char* start = nullptr;
     char* end = nullptr;
@@ -929,7 +931,7 @@ void lokit_main(const std::string& childRoot,
                         it = (it->second->canDiscard() ? _documents.erase(it) : ++it);
                     }
 
-                    if (isDirtyKit && _documents.empty())
+                    if (isUsedKit && _documents.empty())
                         TerminationFlag = true;
                 }
                 else
@@ -981,7 +983,7 @@ void lokit_main(const std::string& childRoot,
                         it = (it->second->canDiscard() ? _documents.erase(it) : ++it);
                     }
 
-                    if (isDirtyKit && _documents.empty())
+                    if (isUsedKit && _documents.empty())
                     {
                         TerminationFlag = true;
                         response += "down \r\n";
@@ -1013,7 +1015,7 @@ void lokit_main(const std::string& childRoot,
                             it = _documents.emplace_hint(it, url, std::make_shared<Document>(loKit, jailId, url));
 
                         it->second->createSession(sessionId, intSessionId);
-                        isDirtyKit = true;
+                        isUsedKit = true;
                         response += "ok \r\n";
                     }
                     else
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 7f052ac..46174c9 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -456,8 +456,8 @@ bool MasterProcessSession::loadDocument(const char* /*buffer*/, int /*length*/,
 
         // Request a kit process for this doc.
         Poco::URI uri(_docURL);
-        const std::string aMessage = "request " + getId() + " " + uri.getPath() + "\n";
-        Log::trace("MasterToBroker: " + aMessage.substr(0, aMessage.length() - 1));
+        const std::string aMessage = "request " + getId() + " " + uri.getPath() + "\r\n";
+        Log::debug("MasterToBroker: " + aMessage.substr(0, aMessage.length() - 1));
         Util::writeFIFO(LOOLWSD::BrokerWritePipe, aMessage);
 
         _tileCache.reset(new TileCache(_docURL, timestamp));
@@ -828,7 +828,7 @@ void MasterProcessSession::dispatchChild()
 void MasterProcessSession::forwardToPeer(const char *buffer, int length)
 {
     const auto message = getAbbreviatedMessage(buffer, length);
-    Log::trace(_kindString + ",forwardToPeer," + message);
+    Log::trace(getName() + " Forward: " + message);
 
     auto peer = _peer.lock();
     if (!peer)
diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 78e9356..7485a9e 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -591,7 +591,7 @@ namespace Util
                 if (byteChar == '\r' && *start == '\n')
                 {
                     start++;
-                    Log::trace(targetPipeName + " recv: " + message);
+                    Log::debug(targetPipeName + " recv: " + message);
                     if (message == "eof")
                         break;
 


More information about the Libreoffice-commits mailing list