From 2cf4fc8d0a64f9052ccbd4427345ef6024fc6a2d Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sat, 24 Jan 2026 21:19:43 -0500 Subject: [PATCH] refactor: remove DEBUG4 level and move any DEBUG4 messages to DEBUG3 --- src/lib/base/Log.cpp | 5 ++--- src/lib/base/Log.h | 2 -- src/lib/base/LogLevel.h | 3 +-- src/lib/deskflow/KeyMap.cpp | 2 +- src/lib/platform/MSWindowsScreen.cpp | 6 +++--- src/lib/server/Server.cpp | 2 +- src/unittests/base/LogTests.cpp | 2 +- src/unittests/legacytests/legacytests/main.cpp | 2 +- 8 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/lib/base/Log.cpp b/src/lib/base/Log.cpp index e0bdee11c..bba61cce0 100644 --- a/src/lib/base/Log.cpp +++ b/src/lib/base/Log.cpp @@ -24,11 +24,10 @@ const int kPriorityPrefixLength = 3; // names of priorities -static const char *g_priority[] = {"FATAL", "ERROR", "WARNING", "NOTE", "INFO", - "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4"}; +static const char *g_priority[] = {"FATAL", "ERROR", "WARNING", "NOTE", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3"}; // number of priorities -static const int g_numPriority = 10; +static const int g_numPriority = 9; // if NDEBUG (not debug) is not specified, i.e. you're building in debug, // then set default log level to DEBUG, otherwise the max level is INFO. diff --git a/src/lib/base/Log.h b/src/lib/base/Log.h index bc0986509..52bf866d6 100644 --- a/src/lib/base/Log.h +++ b/src/lib/base/Log.h @@ -210,7 +210,6 @@ otherwise it expands to a call that doesn't. #define CLOG_DEBUG1 CLOG_TRACE "%z\066" #define CLOG_DEBUG2 CLOG_TRACE "%z\067" #define CLOG_DEBUG3 CLOG_TRACE "%z\070" -#define CLOG_DEBUG4 CLOG_TRACE "%z\071" // char is '9' #define LOG_IPC(...) LOG((CLOG_IPC __VA_ARGS__)) #define LOG_PRINT(...) LOG((CLOG_PRINT __VA_ARGS__)) @@ -223,4 +222,3 @@ otherwise it expands to a call that doesn't. #define LOG_DEBUG1(...) LOG((CLOG_DEBUG1 __VA_ARGS__)) #define LOG_DEBUG2(...) LOG((CLOG_DEBUG2 __VA_ARGS__)) #define LOG_DEBUG3(...) LOG((CLOG_DEBUG3 __VA_ARGS__)) -#define LOG_DEBUG4(...) LOG((CLOG_DEBUG4 __VA_ARGS__)) diff --git a/src/lib/base/LogLevel.h b/src/lib/base/LogLevel.h index 45be5fae0..404b70a0e 100644 --- a/src/lib/base/LogLevel.h +++ b/src/lib/base/LogLevel.h @@ -23,6 +23,5 @@ enum class LogLevel 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 + Debug3 //!< For verbosity +3 debugging messages }; diff --git a/src/lib/deskflow/KeyMap.cpp b/src/lib/deskflow/KeyMap.cpp index 14bdeac3d..d59d06693 100644 --- a/src/lib/deskflow/KeyMap.cpp +++ b/src/lib/deskflow/KeyMap.cpp @@ -88,7 +88,7 @@ void KeyMap::addKeyEntry(const KeyItem &item) // add item list entries.push_back(items); LOG( - (CLOG_DEBUG4 "add key: %04x %d %03x %04x (%04x %04x %04x)%s", newItem.m_id, newItem.m_group, newItem.m_button, + (CLOG_DEBUG3 "add key: %04x %d %03x %04x (%04x %04x %04x)%s", newItem.m_id, newItem.m_group, newItem.m_button, newItem.m_client, newItem.m_required, newItem.m_sensitive, newItem.m_generates, newItem.m_dead ? " dead" : "") ); } diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index 47ed5fd78..01fbc32e6 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -535,7 +535,7 @@ void MSWindowsScreen::saveMousePosition(int32_t x, int32_t y) m_xCursor = x; m_yCursor = y; - LOG_DEBUG4("saved mouse position for next delta: %+d,%+d", x, y); + LOG_DEBUG3("saved mouse position for next delta: %+d,%+d", x, y); } uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) @@ -883,7 +883,7 @@ bool MSWindowsScreen::onPreDispatch(HWND hwnd, UINT message, WPARAM wParam, LPAR bool MSWindowsScreen::onPreDispatchPrimary(HWND, UINT message, WPARAM wParam, LPARAM lParam) { - LOG_DEBUG4("handling pre-dispatch primary"); + LOG_DEBUG3("handling pre-dispatch primary"); // handle event switch (message) { @@ -1245,7 +1245,7 @@ bool MSWindowsScreen::onMouseMove(int32_t mx, int32_t my) // center on the server screen. if we don't do this, then the mouse // will always try to return to the original entry point on the // secondary screen. - LOG_DEBUG4("centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter); + LOG_DEBUG3("centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter); warpCursorNoFlush(m_xCenter, m_yCenter); // examine the motion. if it's about the distance diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index 0531eab6f..239964864 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -1609,7 +1609,7 @@ void Server::onMouseUp(ButtonID id) bool Server::onMouseMovePrimary(int32_t x, int32_t y) { - LOG_DEBUG4("onMouseMovePrimary %d,%d", x, y); + LOG_DEBUG3("onMouseMovePrimary %d,%d", x, y); // mouse move on primary (server's) screen if (m_active != m_primaryClient) { diff --git a/src/unittests/base/LogTests.cpp b/src/unittests/base/LogTests.cpp index 3555596f0..9a2b5071a 100644 --- a/src/unittests/base/LogTests.cpp +++ b/src/unittests/base/LogTests.cpp @@ -85,7 +85,7 @@ void LogTests::printLevelToHigh() std::stringstream buffer; std::streambuf *old = std::cout.rdbuf(buffer.rdbuf()); - m_log.print(CLOG_DEBUG4 "test message"); + m_log.print(CLOG_DEBUG3 "test message"); auto string = sanitizeBuffer(buffer); std::cout.rdbuf(old); diff --git a/src/unittests/legacytests/legacytests/main.cpp b/src/unittests/legacytests/legacytests/main.cpp index e348c37c2..8114e8dbd 100644 --- a/src/unittests/legacytests/legacytests/main.cpp +++ b/src/unittests/legacytests/legacytests/main.cpp @@ -32,7 +32,7 @@ int main(int argc, char **argv) arch.init(); Log log; - log.setFilter(LogLevel::Debug4); + log.setFilter(LogLevel::Debug3); ::testing::GTEST_FLAG(throw_on_failure) = true; testing::InitGoogleTest(&argc, argv);