wsd/AdminModel.cpp | 23 +++++++++++++---------- wsd/AdminModel.hpp | 8 ++++---- 2 files changed, 17 insertions(+), 14 deletions(-)
New commits: commit 942aedb41486d2e68bad670769f64908d06f40c6 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Mon Jan 30 08:10:10 2017 -0500 wsd: AdminModel logging update Change-Id: Ia9225d4778b69f6417d4025876d7e9560918b05b Reviewed-on: https://gerrit.libreoffice.org/33856 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/wsd/AdminModel.cpp b/wsd/AdminModel.cpp index 5055d90..43d7d46 100644 --- a/wsd/AdminModel.cpp +++ b/wsd/AdminModel.cpp @@ -30,7 +30,7 @@ void Document::addView(const std::string& sessionId) const auto ret = _views.emplace(sessionId, View(sessionId)); if (!ret.second) { - Log::warn() << "View with SessionID [" + sessionId + "] already exists." << Log::end; + LOG_WRN("View with SessionID [" << sessionId << "] already exists."); } else { @@ -74,8 +74,8 @@ bool Subscriber::notify(const std::string& message) } catch (const std::exception& ex) { - Log::error() << "Failed to notify Admin subscriber with message [" - << message << "] due to [" << ex.what() << "]." << Log::end; + LOG_ERR("Failed to notify Admin subscriber with message [" << + message << "] due to [" << ex.what() << "]."); } } @@ -147,9 +147,12 @@ unsigned AdminModel::getKitsMemoryUsage() } } - LOG_INF("Got total Kits memory of " << totalMem << " bytes in " << ts.elapsed()/1001. << " ms for " << - docs << " docs, avg: " << static_cast<double>(totalMem) / docs << " bytes / doc in " << - ts.elapsed() / 1000. / docs << " ms per doc."); + if (docs > 0) + { + LOG_TRC("Got total Kits memory of " << totalMem << " bytes in " << ts.elapsed()/1001. << + " ms for " << docs << " docs, avg: " << static_cast<double>(totalMem) / docs << + " bytes / doc in " << ts.elapsed() / 1000. / docs << " ms per doc."); + } return totalMem; } @@ -159,7 +162,7 @@ void AdminModel::subscribe(int sessionId, std::shared_ptr<LOOLWebSocket>& ws) const auto ret = _subscribers.emplace(sessionId, Subscriber(sessionId, ws)); if (!ret.second) { - Log::warn() << "Subscriber already exists" << Log::end; + LOG_WRN("Subscriber already exists"); } } @@ -231,7 +234,7 @@ void AdminModel::notify(const std::string& message) { if (!_subscribers.empty()) { - Log::trace("Message to admin console: " + message); + LOG_TRC("Message to admin console: " << message); for (auto it = std::begin(_subscribers); it != std::end(_subscribers); ) { if (!it->second.notify(message)) @@ -251,7 +254,7 @@ void AdminModel::addDocument(const std::string& docKey, Poco::Process::PID pid, { const auto ret = _documents.emplace(docKey, Document(docKey, pid, filename)); ret.first->second.addView(sessionId); - LOG_DBG("Added admin document [" + docKey + "]."); + LOG_DBG("Added admin document [" << docKey << "]."); // Notify the subscribers const unsigned memUsage = Util::getMemoryUsage(pid); @@ -304,7 +307,7 @@ void AdminModel::removeDocument(const std::string& docKey) notify(msg + pair.first); } - LOG_DBG("Removed admin document [" + docKey + "]."); + LOG_DBG("Removed admin document [" << docKey << "]."); _documents.erase(docIt); } } diff --git a/wsd/AdminModel.hpp b/wsd/AdminModel.hpp index 02cd78a..1251470 100644 --- a/wsd/AdminModel.hpp +++ b/wsd/AdminModel.hpp @@ -98,12 +98,12 @@ public: _ws(ws), _start(std::time(nullptr)) { - Log::info("Subscriber ctor."); + LOG_INF("Subscriber ctor."); } ~Subscriber() { - Log::info("Subscriber dtor."); + LOG_INF("Subscriber dtor."); } bool notify(const std::string& message); @@ -135,12 +135,12 @@ class AdminModel public: AdminModel() { - Log::info("AdminModel ctor."); + LOG_INF("AdminModel ctor."); } ~AdminModel() { - Log::info("AdminModel dtor."); + LOG_INF("AdminModel dtor."); } std::string query(const std::string& command); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits