From d6ffcd37d7f4d78250ab6071e4ad2e06d8472df8 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sat, 24 Jan 2026 21:10:34 -0500 Subject: [PATCH] refactor: remove DEBUG5 level and move any DEBUG5 message to DEBUG4 --- src/lib/base/Log.cpp | 6 +++--- src/lib/base/Log.h | 2 -- src/lib/base/LogLevel.h | 3 +-- src/lib/deskflow/KeyMap.cpp | 2 +- src/lib/platform/MSWindowsScreen.cpp | 9 +++++---- src/unittests/base/LogTests.cpp | 2 +- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/lib/base/Log.cpp b/src/lib/base/Log.cpp index b8fd14e43..e0bdee11c 100644 --- a/src/lib/base/Log.cpp +++ b/src/lib/base/Log.cpp @@ -24,11 +24,11 @@ const int kPriorityPrefixLength = 3; // names of priorities -static const char *g_priority[] = {"FATAL", "ERROR", "WARNING", "NOTE", "INFO", "DEBUG", - "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4", "DEBUG5"}; +static const char *g_priority[] = {"FATAL", "ERROR", "WARNING", "NOTE", "INFO", + "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4"}; // number of priorities -static const int g_numPriority = 11; +static const int g_numPriority = 10; // 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 8fbfb42f8..bc0986509 100644 --- a/src/lib/base/Log.h +++ b/src/lib/base/Log.h @@ -211,7 +211,6 @@ otherwise it expands to a call that doesn't. #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 CLOG_DEBUG5 CLOG_TRACE "%z\072" // char is ':' #define LOG_IPC(...) LOG((CLOG_IPC __VA_ARGS__)) #define LOG_PRINT(...) LOG((CLOG_PRINT __VA_ARGS__)) @@ -225,4 +224,3 @@ otherwise it expands to a call that doesn't. #define LOG_DEBUG2(...) LOG((CLOG_DEBUG2 __VA_ARGS__)) #define LOG_DEBUG3(...) LOG((CLOG_DEBUG3 __VA_ARGS__)) #define LOG_DEBUG4(...) LOG((CLOG_DEBUG4 __VA_ARGS__)) -#define LOG_DEBUG5(...) LOG((CLOG_DEBUG5 __VA_ARGS__)) diff --git a/src/lib/base/LogLevel.h b/src/lib/base/LogLevel.h index a4d877d12..45be5fae0 100644 --- a/src/lib/base/LogLevel.h +++ b/src/lib/base/LogLevel.h @@ -24,6 +24,5 @@ enum class LogLevel 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 + Debug4 //!< For verbosity +4 debugging messages }; diff --git a/src/lib/deskflow/KeyMap.cpp b/src/lib/deskflow/KeyMap.cpp index ed03c0fdd..14bdeac3d 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_DEBUG5 "add key: %04x %d %03x %04x (%04x %04x %04x)%s", newItem.m_id, newItem.m_group, newItem.m_button, + (CLOG_DEBUG4 "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 a606da7a9..47ed5fd78 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_DEBUG5("saved mouse position for next delta: %+d,%+d", x, y); + LOG_DEBUG4("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_DEBUG5("handling pre-dispatch primary"); + LOG_DEBUG4("handling pre-dispatch primary"); // handle event switch (message) { @@ -955,7 +955,8 @@ bool MSWindowsScreen::onEvent(HWND, UINT msg, WPARAM wParam, LPARAM lParam, LRES /* On windows 10 we don't receive WM_POWERBROADCAST after sleep. We receive only WM_TIMECHANGE hence this message is used to resume.*/ case WM_TIMECHANGE: - m_events->addEvent(Event(EventTypes::ScreenResume, getEventTarget(), nullptr, Event::EventFlags::DeliverImmediately) + m_events->addEvent( // + Event(EventTypes::ScreenResume, getEventTarget(), nullptr, Event::EventFlags::DeliverImmediately) ); break; @@ -1244,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_DEBUG5("centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter); + LOG_DEBUG4("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/unittests/base/LogTests.cpp b/src/unittests/base/LogTests.cpp index 9ed35df94..3555596f0 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_DEBUG5 "test message"); + m_log.print(CLOG_DEBUG4 "test message"); auto string = sanitizeBuffer(buffer); std::cout.rdbuf(old);