[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/IoUtil.cpp loolwsd/LOOLKit.cpp loolwsd/LOOLProtocol.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Apr 10 17:21:50 UTC 2016
loolwsd/DocumentBroker.cpp | 2 +-
loolwsd/IoUtil.cpp | 10 +++++++---
loolwsd/LOOLKit.cpp | 6 +++---
loolwsd/LOOLProtocol.hpp | 6 ++++++
4 files changed, 17 insertions(+), 7 deletions(-)
New commits:
commit 4cab42b20f0c4f6f1dd56b20955cca30912be819
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Apr 10 13:13:05 2016 -0400
loolwsd: logging improvements
Change-Id: Idba11b0ae18337d78ea504a455ddc9494cff7ef0
Reviewed-on: https://gerrit.libreoffice.org/23967
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 4b25e48..9f8d37a 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -190,7 +190,7 @@ void DocumentBroker::autoSave()
if (!sent)
{
- Log::error("Failed to save doc [" + _docKey + "]: No valid sessions.");
+ Log::error("Failed to auto-save doc [" + _docKey + "]: No valid sessions.");
}
}
}
diff --git a/loolwsd/IoUtil.cpp b/loolwsd/IoUtil.cpp
index 4a595ec..e24b121 100644
--- a/loolwsd/IoUtil.cpp
+++ b/loolwsd/IoUtil.cpp
@@ -22,6 +22,7 @@
#include <Poco/Net/WebSocket.h>
#include <Poco/Net/NetException.h>
#include <Poco/Thread.h>
+#include <Poco/URI.h>
#include "Common.hpp"
#include "LOOLProtocol.hpp"
@@ -108,6 +109,7 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws,
n = ws->receiveFrame(buffer, sizeof(buffer), flags);
if (n <= 0 || (flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE)
{
+ Log::warn("Connection closed while reading multiframe message.");
break;
}
@@ -157,14 +159,16 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws,
}
}
- Log::debug() << "SocketProcessor finishing. TerminationFlag: " << stop
+ Log::info() << "SocketProcessor finishing. TerminationFlag: " << stop
<< ", n: " << n
<< ", payload size: " << payload.size()
<< ", flags: " << std::hex << flags << Log::end;
if (payload.size() > 1)
{
- Log::warn("Last message (" + std::to_string(payload.size()) + " bytes) will not be processed: [" +
- std::string(payload.data(), payload.size()) + "].");
+ std::string msg;
+ Poco::URI::encode(std::string(payload.data(), payload.size()), "", msg);
+ Log::warn("Last message (" + std::to_string(payload.size()) +
+ " bytes) will not be processed: [" + msg + "].");
}
}
catch (const WebSocketException& exc)
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index ef16180..f531e6b 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -1023,7 +1023,7 @@ void lokit_main(const std::string& childRoot,
UnitKit::get().kitMessage(message);
- Log::debug(socketName + ": recv [" + message + "].");
+ Log::debug(socketName + ": recv [" + LOOLProtocol::getAbbreviatedMessage(message) + "].");
StringTokenizer tokens(message, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
if (TerminationFlag)
@@ -1049,7 +1049,7 @@ void lokit_main(const std::string& childRoot,
if (!(url == document->getUrl() &&
document->createSession(sessionId, intSessionId)))
{
- Log::debug("Create Session failed");
+ Log::debug("CreateSession failed.");
}
}
else if (document && document->canDiscard())
@@ -1058,7 +1058,7 @@ void lokit_main(const std::string& childRoot,
}
else
{
- Log::info("bad unknown token [" + tokens[0] + "]");
+ Log::info("Bad or unknown token [" + tokens[0] + "]");
}
return true;
diff --git a/loolwsd/LOOLProtocol.hpp b/loolwsd/LOOLProtocol.hpp
index 0e7a541..66276b1 100644
--- a/loolwsd/LOOLProtocol.hpp
+++ b/loolwsd/LOOLProtocol.hpp
@@ -92,6 +92,12 @@ namespace LOOLProtocol
/// Returns an abbereviation of the message (the first line, indicating truncation).
std::string getAbbreviatedMessage(const char *message, const int length);
+
+ inline
+ std::string getAbbreviatedMessage(const std::string& message)
+ {
+ return getAbbreviatedMessage(message.data(), message.size());
+ }
};
#endif
More information about the Libreoffice-commits
mailing list