wsd: fix multi-part logging

This was a regression introduced in
14d96957cd.

The result was that multi-part logs were
not flushed and therefore not written to
the output.

Change-Id: Ib22a1da83209b00872d91ca05a940226cbb4552d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
pull/5232/head
Ashod Nakashian 2022-08-28 10:29:47 -04:00 committed by Andras Timar
parent 657b193eb9
commit 0c6413bf87
8 changed files with 17 additions and 9 deletions

View File

@ -272,6 +272,14 @@ static constexpr std::size_t skipPathPrefix(const char (&s)[N], std::size_t n =
#define LOG_END(LOG) LOG << "| " << LOG_FILE_NAME(__FILE__) << ":" STRING(__LINE__)
/// Used to end multi-statement logging via Log::StreamLogger.
#define LOG_END_FLUSH(LOG) \
do \
{ \
LOG_END(LOG); \
LOG.flush(); \
} while (false)
#define LOG_BODY_(LOG, PRIO, LVL, X, END) \
char b_[1024]; \
std::ostringstream oss_(Log::prefix<sizeof(b_) - 1>(b_, LVL), std::ostringstream::ate); \

View File

@ -136,7 +136,7 @@ protected:
logger << tokens.getParam(token) << ' ';
}
LOG_END(logger);
LOG_END_FLUSH(logger);
}
// Note: Syntax or parsing errors here are unexpected and fatal.

View File

@ -2308,7 +2308,7 @@ protected:
logger << tokens.getParam(token) << ' ';
}
LOG_END(logger);
LOG_END_FLUSH(logger);
}
// Note: Syntax or parsing errors here are unexpected and fatal.

View File

@ -1081,7 +1081,7 @@ bool StreamSocket::parseHeader(const char *clientName,
logger << " / " << it.first << ": " << it.second;
}
LOG_END(logger);
LOG_END_FLUSH(logger);
}
const std::streamsize contentLength = request.getContentLength();

View File

@ -112,7 +112,7 @@ private:
logger << " / " << it.first << ": " << it.second;
}
LOG_END(logger);
LOG_END_FLUSH(logger);
}
const std::streamsize contentLength = request.getContentLength();

View File

@ -407,7 +407,7 @@ void cleanupDocBrokers()
logger << "DocumentBroker [" << pair.first << "].\n";
}
LOG_END(logger);
LOG_END_FLUSH(logger);
}
#if !MOBILEAPP && ENABLE_DEBUG

View File

@ -2502,7 +2502,7 @@ void DocumentBroker::finalRemoveSession(const std::string& id)
for (const auto& pair : _sessions)
logger << pair.second->getId() << ' ';
LOG_END(logger);
LOG_END_FLUSH(logger);
}
if (UnitWSD::isUnitTesting())

View File

@ -634,7 +634,7 @@ WopiStorage::getWOPIFileInfoForUri(Poco::URI uriObject, const Authorization& aut
logger << '\t' << pair.first << ": " << pair.second << " / ";
}
LOG_END(logger);
LOG_END_FLUSH(logger);
}
const std::shared_ptr<const http::Response> httpResponse
@ -682,7 +682,7 @@ WopiStorage::getWOPIFileInfoForUri(Poco::URI uriObject, const Authorization& aut
if (failed)
logRes << "\tBody: [" << wopiResponse << "]";
LOG_END(logRes);
LOG_END_FLUSH(logRes);
}
if (failed)
@ -1110,7 +1110,7 @@ std::string WopiStorage::downloadDocument(const Poco::URI& uriObject, const std:
logger << '\t' << pair.first << ": " << pair.second << " / ";
}
LOG_END(logger);
LOG_END_FLUSH(logger);
}
}
else if (httpResponse->statusLine().statusCode() == Poco::Net::HTTPResponse::HTTP_FOUND ||