[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp loolwsd/loolwsd.xml.in loolwsd/TraceFile.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Aug 8 03:53:38 UTC 2016
loolwsd/LOOLWSD.cpp | 2 +-
loolwsd/TraceFile.hpp | 9 +++++++--
loolwsd/loolwsd.xml.in | 3 +++
3 files changed, 11 insertions(+), 3 deletions(-)
New commits:
commit f57964bd058a360ec36fb210c2ff78783c79ecd7
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Thu Aug 4 13:52:28 2016 -0400
loolstress: outgoing trace recording controlled from config
Change-Id: I5788da96d4c2fecde818c6dde8ebfcd6ae206cec
Reviewed-on: https://gerrit.libreoffice.org/27969
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index c86ceb7..a8c397a 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1402,7 +1402,7 @@ void LOOLWSD::initialize(Application& self)
if (getConfigValue<bool>(conf, "trace[@enable]", false))
{
const auto& path = getConfigValue<std::string>(conf, "trace.path", "");
- TraceDumper.reset(new TraceFileWriter(path));
+ TraceDumper.reset(new TraceFileWriter(path, getConfigValue<bool>(conf, "trace.outgoing.record", false)));
Log::info("Command trace dumping enabled to file: " + path);
}
diff --git a/loolwsd/TraceFile.hpp b/loolwsd/TraceFile.hpp
index 5e01967..d9b02bf 100644
--- a/loolwsd/TraceFile.hpp
+++ b/loolwsd/TraceFile.hpp
@@ -40,8 +40,9 @@ public:
class TraceFileWriter
{
public:
- TraceFileWriter(const std::string& path) :
+ TraceFileWriter(const std::string& path, const bool recordOugoing) :
_epochStart(Poco::Timestamp().epochMicroseconds()),
+ _recordOutgoing(recordOugoing),
_stream(path, std::ios::out)
{
}
@@ -63,7 +64,10 @@ public:
void writeOutgoing(const std::string& pId, const std::string& sessionId, const std::string& data)
{
- write(pId, sessionId, data, static_cast<char>(TraceFileRecord::Direction::Outgoing));
+ if (_recordOutgoing)
+ {
+ write(pId, sessionId, data, static_cast<char>(TraceFileRecord::Direction::Outgoing));
+ }
}
private:
@@ -84,6 +88,7 @@ private:
private:
const Poco::Int64 _epochStart;
+ const bool _recordOutgoing;
std::fstream _stream;
std::mutex _mutex;
};
diff --git a/loolwsd/loolwsd.xml.in b/loolwsd/loolwsd.xml.in
index f5916e6..1267210 100644
--- a/loolwsd/loolwsd.xml.in
+++ b/loolwsd/loolwsd.xml.in
@@ -25,6 +25,9 @@
<trace desc="Dump commands and notifications for replay" enable="true">
<path desc="Output file path">/tmp/dump</path>
+ <outgoing>
+ <record desc="Whether or not to record outgoing messages" default="false">false</record>
+ </outgoing>
</trace>
<ssl desc="SSL settings">
More information about the Libreoffice-commits
mailing list