From 77bdde5434c4a7a4ac3fce95211ec2d88b400e9c Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Mon, 7 Jul 2025 17:44:21 -0400 Subject: [PATCH] refactor: Elevel => LogLevel enum class, use proper names for items in the class --- src/lib/arch/IArchLog.h | 4 +- src/lib/arch/unix/ArchLogUnix.cpp | 11 ++--- src/lib/arch/unix/ArchLogUnix.h | 2 +- src/lib/arch/win32/ArchLogWindows.cpp | 6 +-- src/lib/arch/win32/ArchLogWindows.h | 2 +- src/lib/base/CMakeLists.txt | 2 +- src/lib/base/ELevel.h | 28 ------------- src/lib/base/ILogOutputter.h | 4 +- src/lib/base/Log.cpp | 41 ++++++++++--------- src/lib/base/Log.h | 18 ++++---- src/lib/base/LogLevel.h | 28 +++++++++++++ src/lib/base/LogOutputters.cpp | 10 ++--- src/lib/base/LogOutputters.h | 8 ++-- src/lib/net/SslLogger.cpp | 4 +- src/lib/platform/MSWindowsDebugOutputter.cpp | 2 +- src/lib/platform/MSWindowsDebugOutputter.h | 2 +- src/lib/platform/MSWindowsWatchdog.cpp | 4 +- src/lib/platform/XWindowsClipboard.cpp | 2 +- src/unittests/arch/ArchStringTests.cpp | 2 +- src/unittests/base/UnicodeTests.cpp | 2 +- src/unittests/deskflow/ArgParserTests.cpp | 2 +- src/unittests/deskflow/ClipboardTests.cpp | 2 +- src/unittests/deskflow/ConfigTests.cpp | 2 +- .../deskflow/LanguageManagerTests.cpp | 2 +- .../legacytests/legacytests/main.cpp | 2 +- .../platform/MSWindowsClipboardTests.cpp | 2 +- src/unittests/platform/OSXKeyStateTests.cpp | 2 +- 27 files changed, 100 insertions(+), 96 deletions(-) delete mode 100644 src/lib/base/ELevel.h create mode 100644 src/lib/base/LogLevel.h diff --git a/src/lib/arch/IArchLog.h b/src/lib/arch/IArchLog.h index 9c94da679..4605b65b0 100644 --- a/src/lib/arch/IArchLog.h +++ b/src/lib/arch/IArchLog.h @@ -7,7 +7,7 @@ #pragma once -#include "base/ELevel.h" +#include "base/LogLevel.h" #include "common/IInterface.h" //! Interface for architecture dependent logging @@ -47,7 +47,7 @@ public: /*! Writes the given string to the log with the given level. */ - virtual void writeLog(ELevel, const char *) = 0; + virtual void writeLog(LogLevel, const char *) = 0; //@} }; diff --git a/src/lib/arch/unix/ArchLogUnix.cpp b/src/lib/arch/unix/ArchLogUnix.cpp index bc850a367..dc8f81db4 100644 --- a/src/lib/arch/unix/ArchLogUnix.cpp +++ b/src/lib/arch/unix/ArchLogUnix.cpp @@ -28,24 +28,25 @@ void ArchLogUnix::showLog(bool) // do nothing } -void ArchLogUnix::writeLog(ELevel level, const char *msg) +void ArchLogUnix::writeLog(LogLevel level, const char *msg) { // convert level int priority; switch (level) { - case kERROR: + using enum LogLevel; + case Error: priority = LOG_ERR; break; - case kWARNING: + case Warning: priority = LOG_WARNING; break; - case kNOTE: + case Note: priority = LOG_NOTICE; break; - case kINFO: + case Info: priority = LOG_INFO; break; diff --git a/src/lib/arch/unix/ArchLogUnix.h b/src/lib/arch/unix/ArchLogUnix.h index 70a496e91..45c56b500 100644 --- a/src/lib/arch/unix/ArchLogUnix.h +++ b/src/lib/arch/unix/ArchLogUnix.h @@ -22,5 +22,5 @@ public: void openLog(const char *name) override; void closeLog() override; void showLog(bool) override; - void writeLog(ELevel, const char *) override; + void writeLog(LogLevel, const char *) override; }; diff --git a/src/lib/arch/win32/ArchLogWindows.cpp b/src/lib/arch/win32/ArchLogWindows.cpp index b7dada6bd..c49d24e7a 100644 --- a/src/lib/arch/win32/ArchLogWindows.cpp +++ b/src/lib/arch/win32/ArchLogWindows.cpp @@ -38,17 +38,17 @@ void ArchLogWindows::showLog(bool) // do nothing } -void ArchLogWindows::writeLog(ELevel level, const char *msg) +void ArchLogWindows::writeLog(LogLevel level, const char *msg) { if (m_eventLog != nullptr) { // convert priority WORD type; switch (level) { - case kERROR: + case LogLevel::Error: type = EVENTLOG_ERROR_TYPE; break; - case kWARNING: + case LogLevel::Warning: type = EVENTLOG_WARNING_TYPE; break; diff --git a/src/lib/arch/win32/ArchLogWindows.h b/src/lib/arch/win32/ArchLogWindows.h index 472e4c7c7..d562c122a 100644 --- a/src/lib/arch/win32/ArchLogWindows.h +++ b/src/lib/arch/win32/ArchLogWindows.h @@ -25,7 +25,7 @@ public: void openLog(const char *name) override; void closeLog() override; void showLog(bool showIfEmpty) override; - void writeLog(ELevel, const char *) override; + void writeLog(LogLevel, const char *) override; private: HANDLE m_eventLog; diff --git a/src/lib/base/CMakeLists.txt b/src/lib/base/CMakeLists.txt index e654cd696..12581ee84 100644 --- a/src/lib/base/CMakeLists.txt +++ b/src/lib/base/CMakeLists.txt @@ -4,7 +4,6 @@ # SPDX-License-Identifier: MIT add_library(base STATIC - ELevel.h Event.cpp Event.h EventQueue.cpp @@ -24,6 +23,7 @@ add_library(base STATIC LogOutputters.h Log.cpp Log.h + LogLevel.h Path.cpp Path.h PriorityQueue.h diff --git a/src/lib/base/ELevel.h b/src/lib/base/ELevel.h deleted file mode 100644 index 9d4ffdaab..000000000 --- a/src/lib/base/ELevel.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Deskflow -- mouse and keyboard sharing utility - * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd. - * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman - * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception - */ - -#pragma once - -//! Log levels -/*! -The logging priority levels in order of highest to lowest priority. -*/ -enum ELevel -{ - kPRINT = -1, //!< For print only (no file or time) - kFATAL, //!< For fatal errors - kERROR, //!< For serious errors - kWARNING, //!< For minor errors and warnings - kNOTE, //!< For messages about notable events - kINFO, //!< For informational messages - kDEBUG, //!< For important debugging messages - kDEBUG1, //!< For verbosity +1 debugging messages - kDEBUG2, //!< For verbosity +2 debugging messages - kDEBUG3, //!< For verbosity +3 debugging messages - kDEBUG4, //!< For verbosity +4 debugging messages - kDEBUG5 //!< For verbosity +5 debugging messages -}; diff --git a/src/lib/base/ILogOutputter.h b/src/lib/base/ILogOutputter.h index 788da4059..8d74f98e1 100644 --- a/src/lib/base/ILogOutputter.h +++ b/src/lib/base/ILogOutputter.h @@ -7,8 +7,8 @@ #pragma once -#include "base/ELevel.h" #include "base/Log.h" +#include "base/LogLevel.h" #include "common/IInterface.h" //! Outputter interface @@ -53,7 +53,7 @@ public: message to all outputters in the outputter chain, otherwise it continues. Most implementations should return true. */ - virtual bool write(ELevel level, const char *message) = 0; + virtual bool write(LogLevel level, const char *message) = 0; //@} }; diff --git a/src/lib/base/Log.cpp b/src/lib/base/Log.cpp index 015322454..6986921ca 100644 --- a/src/lib/base/Log.cpp +++ b/src/lib/base/Log.cpp @@ -7,6 +7,7 @@ #include "base/Log.h" #include "arch/Arch.h" +#include "base/LogLevel.h" #include "base/LogOutputters.h" #include "common/Constants.h" @@ -33,14 +34,14 @@ static const int g_numPriority = 11; // for visual studio, then NDEBUG will be set (even if your VS solution // config is Debug). #ifndef NDEBUG -static const int g_defaultMaxPriority = kDEBUG; +static const LogLevel g_defaultMaxPriority = LogLevel::Debug; #else -static const int g_defaultMaxPriority = kINFO; +static const LogLevel g_defaultMaxPriority = LogLevel::Info; #endif namespace { -ELevel getPriority(const char *&fmt) +LogLevel getPriority(const char *&fmt) { if (strnlen(fmt, SIZE_MAX) < kPriorityPrefixLength) { throw std::invalid_argument("invalid format string, too short"); @@ -50,7 +51,7 @@ ELevel getPriority(const char *&fmt) throw std::invalid_argument("invalid format string, missing priority"); } - return static_cast(fmt[2] - '0'); + return static_cast(fmt[2] - '0'); } void makeTimeString(std::vector &buffer) @@ -74,7 +75,7 @@ void makeTimeString(std::vector &buffer) ); } -std::vector makeMessage(const char *filename, int lineNumber, const char *message, ELevel priority) +std::vector makeMessage(const char *filename, int lineNumber, const char *message, LogLevel priority) { // base size includes null terminator, colon, space, etc. @@ -82,12 +83,13 @@ std::vector makeMessage(const char *filename, int lineNumber, const char * const int timeBufferSize = 50; const int priorityMaxSize = 10; + const auto currentPriority = static_cast(priority); std::vector timeBuffer(timeBufferSize); makeTimeString(timeBuffer); size_t timestampLength = strnlen(timeBuffer.data(), timeBufferSize); - size_t priorityLength = strnlen(g_priority[priority], priorityMaxSize); + size_t priorityLength = strnlen(g_priority[currentPriority], priorityMaxSize); size_t messageLength = strnlen(message, SIZE_MAX); size_t bufferSize = baseSize + timestampLength + priorityLength + messageLength; @@ -99,13 +101,13 @@ std::vector makeMessage(const char *filename, int lineNumber, const char * std::vector buffer(bufferSize); snprintf( - buffer.data(), bufferSize, "[%s] %s: %s\n\t%s:%d", timeBuffer.data(), g_priority[priority], message, filename, - lineNumber + buffer.data(), bufferSize, "[%s] %s: %s\n\t%s:%d", timeBuffer.data(), g_priority[currentPriority], message, + filename, lineNumber ); return buffer; } else { std::vector buffer(bufferSize); - snprintf(buffer.data(), bufferSize, "[%s] %s: %s", timeBuffer.data(), g_priority[priority], message); + snprintf(buffer.data(), bufferSize, "[%s] %s: %s", timeBuffer.data(), g_priority[currentPriority], message); return buffer; } } @@ -159,12 +161,13 @@ const char *Log::getFilterName() const return getFilterName(getFilter()); } -const char *Log::getFilterName(int level) const +const char *Log::getFilterName(LogLevel level) const { - if (level < 0) { + const auto levelIndex = static_cast(level); + if (levelIndex < 0) { return "Message"; } - return g_priority[level]; + return g_priority[levelIndex]; } void Log::print(const char *file, int line, const char *fmt, ...) @@ -172,7 +175,7 @@ void Log::print(const char *file, int line, const char *fmt, ...) const int initBufferSize = 1024; const int bufferResizeScale = 2; - ELevel priority = getPriority(fmt); + LogLevel priority = getPriority(fmt); fmt += kPriorityPrefixLength; if (priority > getFilter()) { @@ -196,7 +199,7 @@ void Log::print(const char *file, int line, const char *fmt, ...) } } - if (priority == kPRINT) { + if (priority == LogLevel::Print) { output(priority, buffer.data()); } else { auto message = makeMessage(file, line, buffer.data(), priority); @@ -240,7 +243,7 @@ bool Log::setFilter(const char *maxPriority) if (maxPriority != nullptr) { for (int i = 0; i < g_numPriority; ++i) { if (strcmp(maxPriority, g_priority[i]) == 0) { - setFilter(i); + setFilter(static_cast(i)); return true; } } @@ -249,21 +252,21 @@ bool Log::setFilter(const char *maxPriority) return true; } -void Log::setFilter(int maxPriority) +void Log::setFilter(LogLevel maxPriority) { std::scoped_lock lock{m_mutex}; m_maxPriority = maxPriority; } -int Log::getFilter() const +LogLevel Log::getFilter() const { std::scoped_lock lock{m_mutex}; return m_maxPriority; } -void Log::output(ELevel priority, const char *msg) +void Log::output(LogLevel priority, const char *msg) { - assert(priority >= -1 && priority < g_numPriority); + assert(static_cast(priority) >= -1 && static_cast(priority) < g_numPriority); assert(msg != nullptr); if (!msg) return; diff --git a/src/lib/base/Log.h b/src/lib/base/Log.h index 79cedf61b..ba875f595 100644 --- a/src/lib/base/Log.h +++ b/src/lib/base/Log.h @@ -87,7 +87,7 @@ public: bool setFilter(const char *name); //! Set the minimum priority filter (by ordinal). - void setFilter(int); + void setFilter(LogLevel); //@} //! @name accessors @@ -102,28 +102,28 @@ public: void print(const char *file, int line, const char *format, ...); //! Get the minimum priority level. - int getFilter() const; + LogLevel getFilter() const; //! Get the filter name of the current filter level. const char *getFilterName() const; //! Get the filter name of a specified filter level. - const char *getFilterName(int level) const; + const char *getFilterName(LogLevel level) const; //! Get the singleton instance of the log static Log *getInstance(); //! Get the console filter level (messages above this are not sent to //! console). - int getConsoleMaxLevel() const + LogLevel getConsoleMaxLevel() const { - return kDEBUG2; + return LogLevel::Debug2; } //@} private: - void output(ELevel priority, const char *msg); + void output(LogLevel priority, const char *msg); private: using OutputterList = std::list; @@ -133,7 +133,7 @@ private: mutable std::mutex m_mutex; OutputterList m_outputters; OutputterList m_alwaysOutputters; - int m_maxPriority; + LogLevel m_maxPriority; }; /*! @@ -145,7 +145,7 @@ LOG((CLOG_XXX "%d and %d are %s", x, y, x == y ? "equal" : "not equal")); \endcode In particular, notice the double open and close parentheses. Also note that there is no comma after the \c CLOG_XXX. The \c XXX should be -replaced by one of enumerants in \c Log::ELevel without the leading +replaced by one of enumerants in \c Log::LogLevel without the leading \c k. For example, \c CLOG_INFO. The special \c CLOG_PRINT level will not be filtered and is never prefixed by the filename and line number. @@ -164,7 +164,7 @@ LOGC(x == y, (CLOG_XXX "%d and %d are equal", x, y)); \endcode In particular, notice the parentheses around everything after the boolean expression. Also note that there is no comma after the \c CLOG_XXX. -The \c XXX should be replaced by one of enumerants in \c Log::ELevel +The \c XXX should be replaced by one of enumerants in \c Log::LogLevel without the leading \c k. For example, \c CLOG_INFO. The special \c CLOG_PRINT level will not be filtered and is never prefixed by the filename and line number. diff --git a/src/lib/base/LogLevel.h b/src/lib/base/LogLevel.h new file mode 100644 index 000000000..5e1ff48c8 --- /dev/null +++ b/src/lib/base/LogLevel.h @@ -0,0 +1,28 @@ +/* + * Deskflow -- mouse and keyboard sharing utility + * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd. + * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman + * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception + */ + +#pragma once + +//! Log levels +/*! +The logging priority levels in order of highest to lowest priority. +*/ +enum class LogLevel +{ + Print = -1, //!< For print only (no file or time) + Fatal, //!< For fatal errors + Error, //!< For serious errors + Warning, //!< For minor errors and warnings + Note, //!< For messages about notable events + Info, //!< For informational messages + Debug, //!< For important debugging messages + Debug1, //!< For verbosity +1 debugging messages + Debug2, //!< For verbosity +2 debugging messages + Debug3, //!< For verbosity +3 debugging messages + Debug4, //!< For verbosity +4 debugging messages + Debug5 //!< For verbosity +5 debugging messages +}; diff --git a/src/lib/base/LogOutputters.cpp b/src/lib/base/LogOutputters.cpp index fecab83de..7d4b2ca29 100644 --- a/src/lib/base/LogOutputters.cpp +++ b/src/lib/base/LogOutputters.cpp @@ -38,7 +38,7 @@ void StopLogOutputter::show(bool) // do nothing } -bool StopLogOutputter::write(ELevel, const char *) +bool StopLogOutputter::write(LogLevel, const char *) { return false; } @@ -62,9 +62,9 @@ void ConsoleLogOutputter::show(bool showIfEmpty) // do nothing } -bool ConsoleLogOutputter::write(ELevel level, const char *msg) +bool ConsoleLogOutputter::write(LogLevel level, const char *msg) { - if ((level >= kFATAL) && (level <= kWARNING)) + if ((level >= LogLevel::Fatal) && (level <= LogLevel::Warning)) std::cerr << msg << std::endl; else std::cout << msg << std::endl; @@ -96,7 +96,7 @@ void SystemLogOutputter::show(bool showIfEmpty) ARCH->showLog(showIfEmpty); } -bool SystemLogOutputter::write(ELevel level, const char *msg) +bool SystemLogOutputter::write(LogLevel level, const char *msg) { ARCH->writeLog(level, msg); return true; @@ -143,7 +143,7 @@ void FileLogOutputter::setLogFilename(const char *logFile) m_fileName = logFile; } -bool FileLogOutputter::write(ELevel level, const char *message) +bool FileLogOutputter::write(LogLevel level, const char *message) { bool moveFile = false; diff --git a/src/lib/base/LogOutputters.h b/src/lib/base/LogOutputters.h index ede630522..44306c4ce 100644 --- a/src/lib/base/LogOutputters.h +++ b/src/lib/base/LogOutputters.h @@ -28,7 +28,7 @@ public: void open(const char *title) override; void close() override; void show(bool showIfEmpty) override; - bool write(ELevel level, const char *message) override; + bool write(LogLevel level, const char *message) override; }; //! Write log to console @@ -46,7 +46,7 @@ public: void open(const char *title) override; void close() override; void show(bool showIfEmpty) override; - bool write(ELevel level, const char *message) override; + bool write(LogLevel level, const char *message) override; void flush() const; }; @@ -66,7 +66,7 @@ public: void open(const char *title) override; void close() override; void show(bool showIfEmpty) override; - bool write(ELevel level, const char *message) override; + bool write(LogLevel level, const char *message) override; void setLogFilename(const char *title); @@ -88,7 +88,7 @@ public: void open(const char *title) override; void close() override; void show(bool showIfEmpty) override; - bool write(ELevel level, const char *message) override; + bool write(LogLevel level, const char *message) override; }; //! Write log to system log only diff --git a/src/lib/net/SslLogger.cpp b/src/lib/net/SslLogger.cpp index b2b737d72..edfccee70 100644 --- a/src/lib/net/SslLogger.cpp +++ b/src/lib/net/SslLogger.cpp @@ -65,7 +65,7 @@ void logRemoteSecureCipherInfo(const SSL *ssl) void SslLogger::logSecureLibInfo() { - if (CLOG->getFilter() >= kDEBUG) { + if (CLOG->getFilter() >= LogLevel::Debug) { LOG((CLOG_DEBUG "openssl version: %s", SSLeay_version(SSLEAY_VERSION))); LOG((CLOG_DEBUG1 "openssl flags: %s", SSLeay_version(SSLEAY_CFLAGS))); LOG((CLOG_DEBUG1 "openssl built on: %s", SSLeay_version(SSLEAY_BUILT_ON))); @@ -76,7 +76,7 @@ void SslLogger::logSecureLibInfo() void SslLogger::logSecureCipherInfo(const SSL *ssl) { - if (ssl && CLOG->getFilter() >= kDEBUG1) { + if (ssl && CLOG->getFilter() >= LogLevel::Debug1) { logLocalSecureCipherInfo(ssl); logRemoteSecureCipherInfo(ssl); } diff --git a/src/lib/platform/MSWindowsDebugOutputter.cpp b/src/lib/platform/MSWindowsDebugOutputter.cpp index 7222ac3ad..d70150889 100644 --- a/src/lib/platform/MSWindowsDebugOutputter.cpp +++ b/src/lib/platform/MSWindowsDebugOutputter.cpp @@ -26,7 +26,7 @@ void MSWindowsDebugOutputter::show(bool showIfEmpty) // do nothing } -bool MSWindowsDebugOutputter::write(ELevel level, const char *msg) +bool MSWindowsDebugOutputter::write(LogLevel level, const char *msg) { OutputDebugString((std::string(msg) + "\n").c_str()); return true; diff --git a/src/lib/platform/MSWindowsDebugOutputter.h b/src/lib/platform/MSWindowsDebugOutputter.h index 2f19faff0..f2d65eceb 100644 --- a/src/lib/platform/MSWindowsDebugOutputter.h +++ b/src/lib/platform/MSWindowsDebugOutputter.h @@ -24,6 +24,6 @@ public: void open(const char *title) override; void close() override; void show(bool showIfEmpty) override; - bool write(ELevel level, const char *message) override; + bool write(LogLevel level, const char *message) override; void flush(); }; diff --git a/src/lib/platform/MSWindowsWatchdog.cpp b/src/lib/platform/MSWindowsWatchdog.cpp index baeb31ce0..7ee6224b1 100644 --- a/src/lib/platform/MSWindowsWatchdog.cpp +++ b/src/lib/platform/MSWindowsWatchdog.cpp @@ -8,8 +8,8 @@ #include "arch/Arch.h" #include "arch/win32/XArchWindows.h" -#include "base/ELevel.h" #include "base/Log.h" +#include "base/LogLevel.h" #include "base/LogOutputters.h" #include "base/TMethodJob.h" #include "common/Constants.h" @@ -363,7 +363,7 @@ void MSWindowsWatchdog::outputLoop(void *) // strip out windows \r chars to prevent extra lines in log file. std::string output = trimOutputBuffer(buffer); - m_fileLogOutputter.write(kPRINT, output.c_str()); + m_fileLogOutputter.write(LogLevel::Print, output.c_str()); #if SYSAPI_WIN32 if (m_foreground) { diff --git a/src/lib/platform/XWindowsClipboard.cpp b/src/lib/platform/XWindowsClipboard.cpp index 3c0df65d4..a6127e497 100644 --- a/src/lib/platform/XWindowsClipboard.cpp +++ b/src/lib/platform/XWindowsClipboard.cpp @@ -990,7 +990,7 @@ bool XWindowsClipboard::sendReply(Reply *reply) reply->m_replied = true; // nothing to log - if (CLOG->getFilter() < kDEBUG2) { + if (CLOG->getFilter() < LogLevel::Debug2) { sendNotify( reply->m_requestor, m_selection, reply->m_target, reply->m_property, static_cast(reply->m_time) ); diff --git a/src/unittests/arch/ArchStringTests.cpp b/src/unittests/arch/ArchStringTests.cpp index 1ce9d6b6b..f4a75615f 100644 --- a/src/unittests/arch/ArchStringTests.cpp +++ b/src/unittests/arch/ArchStringTests.cpp @@ -12,7 +12,7 @@ void ArchStringTests::initTestCase() { m_arch.init(); - m_log.setFilter(kDEBUG2); + m_log.setFilter(LogLevel::Debug2); } void ArchStringTests::convertStringWCToMB_buffer() diff --git a/src/unittests/base/UnicodeTests.cpp b/src/unittests/base/UnicodeTests.cpp index 158681389..fa7bb6f4a 100644 --- a/src/unittests/base/UnicodeTests.cpp +++ b/src/unittests/base/UnicodeTests.cpp @@ -13,7 +13,7 @@ void UnicodeTests::initTestCase() { m_arch.init(); - m_log.setFilter(kDEBUG2); + m_log.setFilter(LogLevel::Debug2); } void UnicodeTests::UTF32ToUTF8() diff --git a/src/unittests/deskflow/ArgParserTests.cpp b/src/unittests/deskflow/ArgParserTests.cpp index 509e3262f..76231af9a 100644 --- a/src/unittests/deskflow/ArgParserTests.cpp +++ b/src/unittests/deskflow/ArgParserTests.cpp @@ -17,7 +17,7 @@ void ArgParserTests::initTestCase() { m_arch.init(); - m_log.setFilter(kDEBUG2); + m_log.setFilter(LogLevel::Debug2); static deskflow::ArgsBase base; m_parser.setArgsBase(base); } diff --git a/src/unittests/deskflow/ClipboardTests.cpp b/src/unittests/deskflow/ClipboardTests.cpp index 0aacf04a2..e993682c4 100644 --- a/src/unittests/deskflow/ClipboardTests.cpp +++ b/src/unittests/deskflow/ClipboardTests.cpp @@ -13,7 +13,7 @@ void ClipboardTests::initTestCase() { m_arch.init(); - m_log.setFilter(kDEBUG2); + m_log.setFilter(LogLevel::Debug2); } void ClipboardTests::basicFunction() diff --git a/src/unittests/deskflow/ConfigTests.cpp b/src/unittests/deskflow/ConfigTests.cpp index 1dd01d112..12e20083d 100644 --- a/src/unittests/deskflow/ConfigTests.cpp +++ b/src/unittests/deskflow/ConfigTests.cpp @@ -18,7 +18,7 @@ void ConfigTests::initTestCase() QVERIFY(dir.mkpath("tmp/test")); m_arch.init(); - m_log.setFilter(kDEBUG2); + m_log.setFilter(LogLevel::Debug2); } void ConfigTests::loadFile() diff --git a/src/unittests/deskflow/LanguageManagerTests.cpp b/src/unittests/deskflow/LanguageManagerTests.cpp index 43e930533..1985055c6 100644 --- a/src/unittests/deskflow/LanguageManagerTests.cpp +++ b/src/unittests/deskflow/LanguageManagerTests.cpp @@ -12,7 +12,7 @@ void LanguageManagerTests::initTestCase() { m_arch.init(); - m_log.setFilter(kDEBUG2); + m_log.setFilter(LogLevel::Debug2); } void LanguageManagerTests::remoteLanguages() diff --git a/src/unittests/legacytests/legacytests/main.cpp b/src/unittests/legacytests/legacytests/main.cpp index 3b6f278a6..583f4a41b 100644 --- a/src/unittests/legacytests/legacytests/main.cpp +++ b/src/unittests/legacytests/legacytests/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char **argv) arch.init(); Log log; - log.setFilter(kDEBUG4); + log.setFilter(LogLevel::Debug4); ::testing::GTEST_FLAG(throw_on_failure) = true; testing::InitGoogleTest(&argc, argv); diff --git a/src/unittests/platform/MSWindowsClipboardTests.cpp b/src/unittests/platform/MSWindowsClipboardTests.cpp index c9c03b35d..93743894a 100644 --- a/src/unittests/platform/MSWindowsClipboardTests.cpp +++ b/src/unittests/platform/MSWindowsClipboardTests.cpp @@ -13,7 +13,7 @@ void MSWindowsClipboardTests::initTestCase() { m_arch.init(); - m_log.setFilter(kDEBUG2); + m_log.setFilter(LogLevel::Debug2); MSWindowsClipboard clipboard(NULL); diff --git a/src/unittests/platform/OSXKeyStateTests.cpp b/src/unittests/platform/OSXKeyStateTests.cpp index 62a74f274..be12cbc80 100644 --- a/src/unittests/platform/OSXKeyStateTests.cpp +++ b/src/unittests/platform/OSXKeyStateTests.cpp @@ -19,7 +19,7 @@ void OSXKeyStateTests::initTestCase() { m_arch.init(); - m_log.setFilter(kDEBUG2); + m_log.setFilter(LogLevel::Debug2); } void OSXKeyStateTests::mapModifiersFromOSX_OSXMask()