summaryrefslogtreecommitdiffstats
path: root/wsd/DocumentBroker.cpp
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2022-04-03 16:43:34 -0400
committerAndras Timar <andras.timar@collabora.com>2022-04-14 10:12:53 +0200
commit2b46bf4bdc0cc5da1a5c814ea6bddab358d8ac71 (patch)
tree4bbd71064d46f8002cf122cd0dfec2116ef48d03 /wsd/DocumentBroker.cpp
parentwsd: logging and minor cosmetics (diff)
downloadonline-2b46bf4bdc0cc5da1a5c814ea6bddab358d8ac71.tar.gz
online-2b46bf4bdc0cc5da1a5c814ea6bddab358d8ac71.zip
wsd: add LOG_ASSERT to replace assert with extra logging
In NDEBUG builds, where there is no assert macro, we log at debug level to still find issues without adding noise to the logs. However, in ENABLE_DEBUG builds not only do we assert but we also log at error level. Change-Id: I773dbf7bb2b459e505e73d91505b13d8ed2ed6d8 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Diffstat (limited to 'wsd/DocumentBroker.cpp')
-rw-r--r--wsd/DocumentBroker.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 4395c3b754..d64e5d7588 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -659,7 +659,7 @@ bool DocumentBroker::download(const std::shared_ptr<ClientSession>& session, con
firstInstance = true;
}
- assert(_storage != nullptr);
+ LOG_ASSERT(_storage);
// Call the storage specific fileinfo functions
std::string userId, username;
@@ -2254,8 +2254,8 @@ std::size_t DocumentBroker::removeSession(const std::string& id)
}
else if (activeSessionCount > 0)
{
- assert(!_docState.isMarkedToDestroy() &&
- "Have active sessions while marked to destroy.");
+ LOG_ASSERT_MSG(!_docState.isMarkedToDestroy(),
+ "Have active sessions while marked to destroy");
}
}
catch (const std::exception& ex)
@@ -2283,7 +2283,8 @@ void DocumentBroker::disconnectSessionInternal(const std::string& id)
if (_docState.isUnloadRequested())
{
// We must be the last session, flag to destroy if unload is requested.
- assert(countActiveSessions() <= 1 && "Unload-requested with multiple sessions.");
+ LOG_ASSERT_MSG(countActiveSessions() <= 1,
+ "Unload-requested with multiple sessions");
_docState.markToDestroy();
LOG_TRC("Unload requested while disconnecting session ["
<< id << "], having " << _sessions.size()