diff --git a/test/WopiTestServer.hpp b/test/WopiTestServer.hpp index 4bf65ee36..e37a8fdf7 100644 --- a/test/WopiTestServer.hpp +++ b/test/WopiTestServer.hpp @@ -19,6 +19,7 @@ #include #include #include +#include class WopiTestServer : public UnitWSD { @@ -70,7 +71,7 @@ public: _wopiSrc.clear(); Poco::URI::encode(wopiURL.toString(), ":/?", _wopiSrc); - LOG_INF("Connecting to the fake WOPI server: /lool/" << _wopiSrc << "/ws"); + LOG_TST("Connecting to the fake WOPI server: /lool/" << _wopiSrc << "/ws"); _ws.reset(new UnitWebSocket("/lool/" + _wopiSrc + "/ws")); assert(_ws.get()); @@ -112,22 +113,21 @@ protected: Poco::RegularExpression regInfo("/wopi/files/[0-9]"); Poco::RegularExpression regContent("/wopi/files/[0-9]/contents"); - Log::StreamLogger logger = Log::info(); - if (logger.enabled()) { - logger << "Fake wopi host request URI [" << uriReq.toString() << "]:\n"; + std::ostringstream oss; + oss << "Fake wopi host request URI [" << uriReq.toString() << "]:\n"; for (const auto& pair : request) { - logger << '\t' << pair.first << ": " << pair.second << " / "; + oss << '\t' << pair.first << ": " << pair.second << " / "; } - LOG_END(logger, true); + LOG_TST(oss.str()); } // CheckFileInfo if (request.getMethod() == "GET" && regInfo.match(uriReq.getPath())) { - LOG_INF("Fake wopi host request, handling CheckFileInfo: " << uriReq.getPath()); + LOG_TST("Fake wopi host request, handling CheckFileInfo: " << uriReq.getPath()); assertCheckFileInfoRequest(request); @@ -167,7 +167,7 @@ protected: // GetFile else if (request.getMethod() == "GET" && regContent.match(uriReq.getPath())) { - LOG_INF("Fake wopi host request, handling GetFile: " << uriReq.getPath()); + LOG_TST("Fake wopi host request, handling GetFile: " << uriReq.getPath()); assertGetFileRequest(request); @@ -189,7 +189,7 @@ protected: } else if (request.getMethod() == "POST" && regInfo.match(uriReq.getPath())) { - LOG_INF("Fake wopi host request, handling PutRelativeFile: " << uriReq.getPath()); + LOG_TST("Fake wopi host request, handling PutRelativeFile: " << uriReq.getPath()); std::string wopiURL = helpers::getTestServerURI() + "/something wopi/files/1?access_token=anything&reuse_cookies=cook=well"; std::string content; @@ -223,7 +223,7 @@ protected: } else if (request.getMethod() == "POST" && regContent.match(uriReq.getPath())) { - LOG_INF("Fake wopi host request, handling PutFile: " << uriReq.getPath()); + LOG_TST("Fake wopi host request, handling PutFile: " << uriReq.getPath()); std::string wopiTimestamp = request.get("X-LOOL-WOPI-Timestamp"); if (!wopiTimestamp.empty()) diff --git a/test/testlog.hpp b/test/testlog.hpp index 8de043ad1..eeb1b9852 100644 --- a/test/testlog.hpp +++ b/test/testlog.hpp @@ -74,6 +74,10 @@ inline void tstLog(const std::ostringstream& stream) { writeTestLog(stream.str() TST_LOG_END_X(oss_log_name); \ } while (false) +/// Used by the "old-style" tests. FIXME: Unify. #define TST_LOG(X) TST_LOG_NAME(testname, X) +/// Used by the "new-style" tests. FIXME: Unify. +#define LOG_TST(X) TST_LOG_NAME(getTestname(), X) + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */