From 63db311d5a64b9942dc69e1b13b4570a548554c0 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sat, 13 May 2017 15:10:07 +0900 Subject: Refactored logging enhancements logging.h/logging.cpp is now a full-fledged pair for all things logging. Two more categories added, EPHEMERAL and SYNCJOB, that control logging for ephemeral events and SyncJob, respectively (in particular, switching off EPHEMERAL greatly reduces the logspam about moving read markers and how many users have read up to which event). --- util.h | 55 +------------------------------------------------------ 1 file changed, 1 insertion(+), 54 deletions(-) (limited to 'util.h') diff --git a/util.h b/util.h index 29e623c9..79f76860 100644 --- a/util.h +++ b/util.h @@ -18,51 +18,8 @@ #pragma once -#include - -Q_DECLARE_LOGGING_CATEGORY(EVENTS) -Q_DECLARE_LOGGING_CATEGORY(JOBS) -Q_DECLARE_LOGGING_CATEGORY(MAIN) - namespace QMatrixClient { - - // QDebug manipulators - - using QDebugManip = QDebug (*)(QDebug); - - /** - * @brief QDebug manipulator to setup the stream for JSON output - * - * Originally made to encapsulate the change in QDebug behavior in Qt 5.4 - * and the respective addition of QDebug::noquote(). - * Together with the operator<<() helper, the proposed usage is - * (similar to std:: I/O manipulators): - * - * @example qCDebug() << formatJson << json_object; // (QJsonObject, etc.) - */ - inline QDebug formatJson(QDebug debug_object) - { -#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) - return debug_object; -#else - return debug_object.noquote(); -#endif - }; - - /** - * @brief A helper operator to facilitate usage of formatJson (and possibly - * other manipulators) - * - * @param debug_object to output the json to - * @param qdm a QDebug manipulator - * @return a copy of debug_object that has its mode altered by qdm - */ - inline QDebug operator<< (QDebug debug_object, QDebugManip qdm) - { - return qdm(debug_object); - } - /** * @brief A crude wrapper around a container of pointers that owns pointers * to contained objects @@ -77,17 +34,8 @@ namespace QMatrixClient { public: Owning() = default; -#if defined(_MSC_VER) && _MSC_VER < 1900 - // Workaround: Dangerous (auto_ptr style) copy constructor because - // in case of Owning< QVector<> > VS2013 (unnecessarily) instantiates - // QVector<>::toList() which instantiates QList< Owning<> > which - // requires the contained object to have a copy constructor. - Owning(Owning& other) : ContainerT(other.release()) { } - Owning(Owning&& other) : ContainerT(other.release()) { } -#else Owning(Owning&) = delete; Owning(Owning&& other) = default; -#endif Owning& operator=(Owning&& other) { assign(other.release()); @@ -166,6 +114,5 @@ namespace QMatrixClient { return fallback; } - -} +} // namespace QMatrixClient -- cgit v1.2.3