From 8e469379e8103556c0370c958aaeca66a7a6569d Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Fri, 8 May 2026 21:10:59 -0400 Subject: [PATCH] refactor(log): Squash all Debug1 And Debug2 logs into Verbose fixes: #9725 BREAKING_CHANGE: log level values have changed settings for log level may need to be reset --- src/lib/base/Log.cpp | 4 +- src/lib/base/Log.h | 11 +-- src/lib/base/LogLevel.h | 3 +- src/lib/client/Client.cpp | 14 ++-- src/lib/client/ServerProxy.cpp | 52 ++++++------ src/lib/common/Settings.h | 3 +- src/lib/deskflow/App.cpp | 2 +- src/lib/deskflow/ClientApp.cpp | 2 +- src/lib/deskflow/ClipboardChunk.cpp | 8 +- src/lib/deskflow/KeyMap.cpp | 62 +++++++------- src/lib/deskflow/KeyState.cpp | 14 ++-- src/lib/deskflow/ProtocolUtil.cpp | 20 ++--- src/lib/deskflow/Screen.cpp | 6 +- src/lib/deskflow/ServerApp.cpp | 14 ++-- src/lib/deskflow/ipc/IpcServer.cpp | 14 ++-- src/lib/deskflow/unix/X11LayoutsParser.cpp | 2 +- src/lib/gui/dialogs/SettingsDialog.cpp | 3 +- src/lib/gui/dialogs/SettingsDialog.ui | 27 +++---- src/lib/mt/Thread.cpp | 8 +- src/lib/net/SecureSocket.cpp | 22 ++--- src/lib/net/SslLogger.cpp | 28 +++---- src/lib/platform/EiEventQueueBuffer.cpp | 4 +- src/lib/platform/EiKeyState.cpp | 10 +-- src/lib/platform/EiScreen.cpp | 12 +-- src/lib/platform/MSWindowsDesks.cpp | 14 ++-- src/lib/platform/MSWindowsKeyState.cpp | 14 ++-- src/lib/platform/MSWindowsScreen.cpp | 30 +++---- src/lib/platform/MSWindowsScreenSaver.cpp | 2 +- src/lib/platform/MSWindowsSession.cpp | 4 +- src/lib/platform/MSWindowsWatchdog.cpp | 20 ++--- src/lib/platform/OSXClipboard.cpp | 2 +- src/lib/platform/OSXClipboardBMPConverter.cpp | 2 +- src/lib/platform/OSXEventQueueBuffer.cpp | 14 ++-- src/lib/platform/OSXKeyState.cpp | 22 ++--- src/lib/platform/OSXScreen.mm | 34 ++++---- src/lib/platform/OSXScreenSaver.cpp | 4 +- src/lib/platform/WlClipboardCollection.cpp | 2 +- src/lib/platform/XWindowsClipboard.cpp | 81 ++++++++++--------- src/lib/platform/XWindowsKeyState.cpp | 18 ++--- src/lib/platform/XWindowsScreen.cpp | 40 ++++----- src/lib/platform/XWindowsUtil.cpp | 8 +- src/lib/server/ClientListener.cpp | 6 +- src/lib/server/ClientProxy.cpp | 2 +- src/lib/server/ClientProxy1_0.cpp | 34 ++++---- src/lib/server/ClientProxy1_1.cpp | 8 +- src/lib/server/ClientProxy1_2.cpp | 2 +- src/lib/server/ClientProxy1_3.cpp | 2 +- src/lib/server/ClientProxy1_7.cpp | 2 +- src/lib/server/ClientProxy1_8.cpp | 6 +- src/lib/server/ClientProxyUnknown.cpp | 6 +- src/lib/server/InputFilter.cpp | 6 +- src/lib/server/Server.cpp | 68 ++++++++-------- src/unittests/base/LogTests.cpp | 4 +- src/unittests/base/UnicodeTests.cpp | 2 +- src/unittests/common/SettingsTests.cpp | 3 +- src/unittests/deskflow/ClipboardTests.cpp | 2 +- .../deskflow/KeyboardLayoutManagerTests.cpp | 2 +- .../legacytests/legacytests/main.cpp | 2 +- .../platform/MSWindowsClipboardTests.cpp | 2 +- src/unittests/platform/OSXKeyStateTests.cpp | 2 +- src/unittests/platform/WlClipboardTests.cpp | 2 +- translations/deskflow_es.ts | 24 ++---- translations/deskflow_it.ts | 24 ++---- translations/deskflow_ja.ts | 24 ++---- translations/deskflow_ko.ts | 24 ++---- translations/deskflow_ru.ts | 24 ++---- translations/deskflow_zh_CN.ts | 24 ++---- 67 files changed, 452 insertions(+), 511 deletions(-) diff --git a/src/lib/base/Log.cpp b/src/lib/base/Log.cpp index 7abbe3e68..26b1daf95 100644 --- a/src/lib/base/Log.cpp +++ b/src/lib/base/Log.cpp @@ -24,10 +24,10 @@ const int kPriorityPrefixLength = 3; // names of priorities -static const char *g_priority[] = {"FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2"}; +static const char *g_priority[] = {"FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "VERBOSE"}; // number of priorities -static const int g_numPriority = 7; +static const int g_numPriority = 6; // 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 20717ed5b..85cfc1311 100644 --- a/src/lib/base/Log.h +++ b/src/lib/base/Log.h @@ -118,7 +118,7 @@ public: //! console). LogLevel getConsoleMaxLevel() const { - return LogLevel::Debug2; + return LogLevel::Verbose; } //@} @@ -207,8 +207,7 @@ otherwise it expands to a call that doesn't. #define CLOG_TAG_WARN "%z\062" #define CLOG_TAG_INFO "%z\063" #define CLOG_TAG_DEBUG "%z\064" -#define CLOG_TAG_DEBUG1 "%z\065" -#define CLOG_TAG_DEBUG2 "%z\066" +#define CLOG_TAG_VERBOSE "%z\065" #define CLOG_PRINT CLOG_TRACE CLOG_TAG_PRINT #define CLOG_CRIT CLOG_TRACE CLOG_TAG_CRIT @@ -216,8 +215,7 @@ otherwise it expands to a call that doesn't. #define CLOG_WARN CLOG_TRACE CLOG_TAG_WARN #define CLOG_INFO CLOG_TRACE CLOG_TAG_INFO #define CLOG_DEBUG CLOG_TRACE CLOG_TAG_DEBUG -#define CLOG_DEBUG1 CLOG_TRACE CLOG_TAG_DEBUG1 -#define CLOG_DEBUG2 CLOG_TRACE CLOG_TAG_DEBUG2 +#define CLOG_VERBOSE CLOG_TRACE CLOG_TAG_VERBOSE #define LOG_PRINT(...) LOG((CLOG_PRINT __VA_ARGS__)) #define LOG_CRIT(...) LOG((CLOG_CRIT __VA_ARGS__)) @@ -225,5 +223,4 @@ otherwise it expands to a call that doesn't. #define LOG_WARN(...) LOG((CLOG_WARN __VA_ARGS__)) #define LOG_INFO(...) LOG((CLOG_INFO __VA_ARGS__)) #define LOG_DEBUG(...) LOG((CLOG_DEBUG __VA_ARGS__)) -#define LOG_DEBUG1(...) LOG((CLOG_DEBUG1 __VA_ARGS__)) -#define LOG_DEBUG2(...) LOG((CLOG_DEBUG2 __VA_ARGS__)) +#define LOG_VERBOSE(...) LOG((CLOG_VERBOSE __VA_ARGS__)) diff --git a/src/lib/base/LogLevel.h b/src/lib/base/LogLevel.h index 5751738fb..ebe310ee0 100644 --- a/src/lib/base/LogLevel.h +++ b/src/lib/base/LogLevel.h @@ -19,6 +19,5 @@ enum class LogLevel Warning, //!< For minor errors and warnings Info, //!< For informational messages Debug, //!< For important debugging messages - Debug1, //!< For verbosity +1 debugging messages - Debug2 //!< For verbosity +2 debugging messages + Verbose //!< For verbose debugging messages }; diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index e300f654d..0bcef46db 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -110,7 +110,7 @@ void Client::connect(size_t addressIndex) m_stream = new PacketStreamFilter(m_events, socket, true); // connect - LOG_DEBUG1("connecting to server"); + LOG_VERBOSE("connecting to server"); setupConnecting(); setupTimer(); socket->connect(m_serverAddress); @@ -118,7 +118,7 @@ void Client::connect(size_t addressIndex) cleanupTimer(); cleanupConnecting(); cleanupStream(); - LOG_DEBUG1("connection failed"); + LOG_VERBOSE("connection failed"); sendConnectionFailedEvent(e.what()); return; } @@ -493,7 +493,7 @@ void Client::cleanupStream() void Client::handleConnected() { - LOG_DEBUG1("connected, waiting for hello"); + LOG_VERBOSE("connected, waiting for hello"); cleanupConnecting(); setupConnection(); @@ -512,7 +512,7 @@ void Client::handleConnectionFailed(const Event &event) cleanupTimer(); cleanupConnecting(); cleanupStream(); - LOG_DEBUG1("connection failed"); + LOG_VERBOSE("connection failed"); sendConnectionFailedEvent(info->m_what.c_str()); delete info; } @@ -523,7 +523,7 @@ void Client::handleConnectTimeout() cleanupConnecting(); cleanupConnection(); cleanupStream(); - LOG_DEBUG1("connection timed out"); + LOG_VERBOSE("connection timed out"); sendConnectionFailedEvent("Timed out"); } @@ -541,7 +541,7 @@ void Client::handleDisconnected() cleanupTimer(); cleanupScreen(); cleanupConnection(); - LOG_DEBUG1("disconnected"); + LOG_VERBOSE("disconnected"); sendEvent(EventTypes::ClientDisconnected); } @@ -643,7 +643,7 @@ void Client::bindNetworkInterface(IDataSocket *socket) const { try { if (const auto address = Settings::value(Settings::Core::Interface).toString(); !address.isEmpty()) { - LOG_DEBUG1("bind to network interface: %s", qPrintable(address)); + LOG_VERBOSE("bind to network interface: %s", qPrintable(address)); NetworkAddress bindAddress(address.toStdString()); bindAddress.resolve(); diff --git a/src/lib/client/ServerProxy.cpp b/src/lib/client/ServerProxy.cpp index 10afcca36..4413bb5e0 100644 --- a/src/lib/client/ServerProxy.cpp +++ b/src/lib/client/ServerProxy.cpp @@ -90,7 +90,7 @@ void ServerProxy::handleData() } // parse message - LOG_DEBUG2("msg from server: %c%c%c%c", code[0], code[1], code[2], code[3]); + LOG_VERBOSE("msg from server: %c%c%c%c", code[0], code[1], code[2], code[3]); try { switch ((this->*m_parser)(code)) { using enum ConnectionResult; @@ -165,7 +165,7 @@ ServerProxy::ConnectionResult ServerProxy::parseHandshakeMessage(const uint8_t * else if (memcmp(code, kMsgCClose, 4) == 0) { // server wants us to hangup - LOG_DEBUG1("recv close"); + LOG_VERBOSE("recv close"); m_client->disconnect(nullptr); return Disconnect; } @@ -225,7 +225,7 @@ ServerProxy::ConnectionResult ServerProxy::parseMessage(const uint8_t *code) uint16_t mask = 0; uint16_t button = 0; ProtocolUtil::readf(m_stream, kMsgDKeyDown + 4, &id, &mask, &button); - LOG_DEBUG1("recv key down id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button); + LOG_VERBOSE("recv key down id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button); keyDown(id, mask, button, ""); } @@ -237,7 +237,7 @@ ServerProxy::ConnectionResult ServerProxy::parseMessage(const uint8_t *code) uint16_t button = 0; ProtocolUtil::readf(m_stream, kMsgDKeyDownLang + 4, &id, &mask, &button, &lang); - LOG_DEBUG1("recv key down id=0x%08x, mask=0x%04x, button=0x%04x, lang=\"%s\"", id, mask, button, lang.c_str()); + LOG_VERBOSE("recv key down id=0x%08x, mask=0x%04x, button=0x%04x, lang=\"%s\"", id, mask, button, lang.c_str()); keyDown(id, mask, button, lang); } @@ -310,7 +310,7 @@ ServerProxy::ConnectionResult ServerProxy::parseMessage(const uint8_t *code) else if (memcmp(code, kMsgCClose, 4) == 0) { // server wants us to hangup - LOG_DEBUG1("recv close"); + LOG_VERBOSE("recv close"); m_client->disconnect(nullptr); return Disconnect; } else if (memcmp(code, kMsgEBad, 4) == 0) { @@ -351,7 +351,7 @@ void ServerProxy::onInfoChanged() bool ServerProxy::onGrabClipboard(ClipboardID id) { - LOG_DEBUG1("sending clipboard %d changed", id); + LOG_VERBOSE("sending clipboard %d changed", id); ProtocolUtil::writef(m_stream, kMsgCClipboard, id, m_seqNum); return true; } @@ -380,7 +380,7 @@ void ServerProxy::flushCompressedMouse() void ServerProxy::sendInfo(const ClientInfo &info) { - LOG_DEBUG1("sending info shape=%d,%d %dx%d", info.m_x, info.m_y, info.m_w, info.m_h); + LOG_VERBOSE("sending info shape=%d,%d %dx%d", info.m_x, info.m_y, info.m_w, info.m_h); ProtocolUtil::writef(m_stream, kMsgDInfo, info.m_x, info.m_y, info.m_w, info.m_h, 0, info.m_mx, info.m_my); } @@ -497,7 +497,7 @@ void ServerProxy::enter() uint16_t mask; uint32_t seqNum; ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask); - LOG_DEBUG1("recv enter, %d,%d %d %04x", x, y, seqNum, mask); + LOG_VERBOSE("recv enter, %d,%d %d %04x", x, y, seqNum, mask); // discard old compressed mouse motion, if any m_compressMouse = false; @@ -515,7 +515,7 @@ void ServerProxy::enter() void ServerProxy::leave() { // parse - LOG_DEBUG1("recv leave"); + LOG_VERBOSE("recv leave"); // send last mouse motion flushCompressedMouse(); @@ -575,7 +575,7 @@ void ServerProxy::keyDown(uint16_t id, uint16_t mask, uint16_t button, const std KeyID id2 = translateKey(static_cast(id)); KeyModifierMask mask2 = translateModifierMask(static_cast(mask)); if (id2 != static_cast(id) || mask2 != static_cast(mask)) - LOG_DEBUG1("key down translated to id=0x%08x, mask=0x%04x", id2, mask2); + LOG_VERBOSE("key down translated to id=0x%08x, mask=0x%04x", id2, mask2); // forward m_client->keyDown(id2, mask2, button, lang); @@ -594,8 +594,8 @@ void ServerProxy::keyRepeat() std::string lang; ProtocolUtil::readf(m_stream, kMsgDKeyRepeat + 4, &id, &mask, &count, &button, &lang); LOG( - (CLOG_DEBUG1 "recv key repeat id=0x%08x, mask=0x%04x, count=%d, " - "button=0x%04x, lang=\"%s\"", + (CLOG_VERBOSE "recv key repeat id=0x%08x, mask=0x%04x, count=%d, " + "button=0x%04x, lang=\"%s\"", id, mask, count, button, lang.c_str()) ); @@ -603,7 +603,7 @@ void ServerProxy::keyRepeat() KeyID id2 = translateKey(static_cast(id)); KeyModifierMask mask2 = translateModifierMask(static_cast(mask)); if (id2 != static_cast(id) || mask2 != static_cast(mask)) - LOG_DEBUG1("key repeat translated to id=0x%08x, mask=0x%04x", id2, mask2); + LOG_VERBOSE("key repeat translated to id=0x%08x, mask=0x%04x", id2, mask2); // forward m_client->keyRepeat(id2, mask2, count, button, lang); @@ -619,13 +619,13 @@ void ServerProxy::keyUp() uint16_t mask; uint16_t button; ProtocolUtil::readf(m_stream, kMsgDKeyUp + 4, &id, &mask, &button); - LOG_DEBUG1("recv key up id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button); + LOG_VERBOSE("recv key up id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button); // translate KeyID id2 = translateKey(static_cast(id)); KeyModifierMask mask2 = translateModifierMask(static_cast(mask)); if (id2 != static_cast(id) || mask2 != static_cast(mask)) - LOG_DEBUG1("key up translated to id=0x%08x, mask=0x%04x", id2, mask2); + LOG_VERBOSE("key up translated to id=0x%08x, mask=0x%04x", id2, mask2); // forward m_client->keyUp(id2, mask2, button); @@ -639,7 +639,7 @@ void ServerProxy::mouseDown() // parse int8_t id; ProtocolUtil::readf(m_stream, kMsgDMouseDown + 4, &id); - LOG_DEBUG1("recv mouse down id=%d", id); + LOG_VERBOSE("recv mouse down id=%d", id); // forward m_client->mouseDown(static_cast(id)); @@ -653,7 +653,7 @@ void ServerProxy::mouseUp() // parse int8_t id; ProtocolUtil::readf(m_stream, kMsgDMouseUp + 4, &id); - LOG_DEBUG1("recv mouse up id=%d", id); + LOG_VERBOSE("recv mouse up id=%d", id); // forward m_client->mouseUp(static_cast(id)); @@ -684,7 +684,7 @@ void ServerProxy::mouseMove() m_dxMouse = 0; m_dyMouse = 0; } - LOG_DEBUG2("recv mouse move %d,%d", x, y); + LOG_VERBOSE("recv mouse move %d,%d", x, y); // forward if (!ignore) { @@ -714,7 +714,7 @@ void ServerProxy::mouseRelativeMove() m_dxMouse += dx; m_dyMouse += dy; } - LOG_DEBUG2("recv mouse relative move %d,%d", dx, dy); + LOG_VERBOSE("recv mouse relative move %d,%d", dx, dy); // forward if (!ignore) { @@ -731,7 +731,7 @@ void ServerProxy::mouseWheel() int16_t xDelta; int16_t yDelta; ProtocolUtil::readf(m_stream, kMsgDMouseWheel + 4, &xDelta, &yDelta); - LOG_DEBUG2("recv mouse wheel %+d,%+d", xDelta, yDelta); + LOG_VERBOSE("recv mouse wheel %+d,%+d", xDelta, yDelta); // forward m_client->mouseWheel(xDelta, yDelta); @@ -742,7 +742,7 @@ void ServerProxy::screensaver() // parse int8_t on; ProtocolUtil::readf(m_stream, kMsgCScreenSaver + 4, &on); - LOG_DEBUG1("recv screen saver on=%d", on); + LOG_VERBOSE("recv screen saver on=%d", on); // forward m_client->screensaver(on != 0); @@ -751,7 +751,7 @@ void ServerProxy::screensaver() void ServerProxy::resetOptions() { // parse - LOG_DEBUG1("recv reset options"); + LOG_VERBOSE("recv reset options"); // forward m_client->resetOptions(); @@ -770,7 +770,7 @@ void ServerProxy::setOptions() // parse OptionsList options; ProtocolUtil::readf(m_stream, kMsgDSetOptions + 4, &options); - LOG_DEBUG1("recv set options size=%d", options.size()); + LOG_VERBOSE("recv set options size=%d", options.size()); // forward m_client->setOptions(options); @@ -797,7 +797,7 @@ void ServerProxy::setOptions() if (id != kKeyModifierIDNull) { m_modifierTranslationTable[id] = options[i + 1]; - LOG_DEBUG1("modifier %d mapped to %d", id, m_modifierTranslationTable[id]); + LOG_VERBOSE("modifier %d mapped to %d", id, m_modifierTranslationTable[id]); } } } @@ -812,7 +812,7 @@ void ServerProxy::queryInfo() void ServerProxy::infoAcknowledgment() { - LOG_DEBUG1("recv info acknowledgment"); + LOG_VERBOSE("recv info acknowledgment"); m_ignoreMouse = false; } @@ -847,6 +847,6 @@ void ServerProxy::setActiveServerLanguage(const std::string_view &language) m_isUserNotifiedAboutLayoutSyncError = false; } } else { - LOG_DEBUG1("active server layout is empty"); + LOG_VERBOSE("active server layout is empty"); } } diff --git a/src/lib/common/Settings.h b/src/lib/common/Settings.h index ab23dffde..4000f8fac 100644 --- a/src/lib/common/Settings.h +++ b/src/lib/common/Settings.h @@ -196,8 +196,7 @@ private: , QStringLiteral("WARNING") , QStringLiteral("INFO") , QStringLiteral("DEBUG") - , QStringLiteral("DEBUG1") - , QStringLiteral("DEBUG2") + , QStringLiteral("TRACE") }; inline static const QStringList m_validKeys = { diff --git a/src/lib/deskflow/App.cpp b/src/lib/deskflow/App.cpp index b58845247..764807281 100644 --- a/src/lib/deskflow/App.cpp +++ b/src/lib/deskflow/App.cpp @@ -127,7 +127,7 @@ void App::setupFileLogging() const auto file = Settings::value(Settings::Log::File).toString(); m_fileLog = new FileLogOutputter(file); // NOSONAR - Adopted by `Log` CLOG->insert(m_fileLog); - LOG_DEBUG1("logging to file (%s) enabled", qPrintable(file)); + LOG_VERBOSE("logging to file (%s) enabled", qPrintable(file)); } } diff --git a/src/lib/deskflow/ClientApp.cpp b/src/lib/deskflow/ClientApp.cpp index df4f76035..7e3ba3464 100644 --- a/src/lib/deskflow/ClientApp.cpp +++ b/src/lib/deskflow/ClientApp.cpp @@ -376,7 +376,7 @@ void ClientApp::startNode() { // start the client. if this return false then we've failed and // we shouldn't retry. - LOG_DEBUG1("starting client"); + LOG_VERBOSE("starting client"); if (!startClient()) { bye(s_exitFailed); } diff --git a/src/lib/deskflow/ClipboardChunk.cpp b/src/lib/deskflow/ClipboardChunk.cpp index 7abbdba1a..b85f27941 100644 --- a/src/lib/deskflow/ClipboardChunk.cpp +++ b/src/lib/deskflow/ClipboardChunk.cpp @@ -100,7 +100,7 @@ void ClipboardChunk::send(deskflow::IStream *stream, void *data) { const auto *clipboardData = static_cast(data); - LOG_DEBUG1("sending clipboard chunk"); + LOG_VERBOSE("sending clipboard chunk"); const char *chunk = clipboardData->m_chunk; ClipboardID id = chunk[0]; @@ -111,15 +111,15 @@ void ClipboardChunk::send(deskflow::IStream *stream, void *data) switch (mark) { case ChunkType::DataStart: - LOG_DEBUG2("sending clipboard chunk start: size=%s", dataChunk.c_str()); + LOG_VERBOSE("sending clipboard chunk start: size=%s", dataChunk.c_str()); break; case ChunkType::DataChunk: - LOG_DEBUG2("sending clipboard chunk data: size=%i", dataChunk.size()); + LOG_VERBOSE("sending clipboard chunk data: size=%i", dataChunk.size()); break; case ChunkType::DataEnd: - LOG_DEBUG2("sending clipboard finished"); + LOG_VERBOSE("sending clipboard finished"); break; default: diff --git a/src/lib/deskflow/KeyMap.cpp b/src/lib/deskflow/KeyMap.cpp index a25f627dc..17d1e61fb 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_DEBUG2 "add key: %04x %d %03x %04x (%04x %04x %04x)%s", newItem.m_id, newItem.m_group, newItem.m_button, + (CLOG_VERBOSE "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" : "") ); } @@ -230,7 +230,7 @@ const KeyMap::KeyItem *KeyMap::mapKey( ) const { LOG( - (CLOG_DEBUG1 "mapKey %04x (%d) with mask %04x, start state: %04x, group: %d", id, id, desiredMask, currentState, + (CLOG_VERBOSE "mapKey %04x (%d) with mask %04x, start state: %04x, group: %d", id, id, desiredMask, currentState, group) ); @@ -264,7 +264,7 @@ const KeyMap::KeyItem *KeyMap::mapKey( case kKeySetModifiers: if (!keysForModifierState(0, group, activeModifiers, currentState, desiredMask, desiredMask, 0, keys)) { - LOG_DEBUG1("unable to set modifiers %04x", desiredMask); + LOG_VERBOSE("unable to set modifiers %04x", desiredMask); return nullptr; } return &m_modifierKeyItem; @@ -273,7 +273,7 @@ const KeyMap::KeyItem *KeyMap::mapKey( if (!keysForModifierState( 0, group, activeModifiers, currentState, currentState & ~desiredMask, desiredMask, 0, keys )) { - LOG_DEBUG1("unable to clear modifiers %04x", desiredMask); + LOG_VERBOSE("unable to clear modifiers %04x", desiredMask); return nullptr; } return &m_modifierKeyItem; @@ -288,7 +288,7 @@ const KeyMap::KeyItem *KeyMap::mapKey( } if (item != nullptr) { - LOG_DEBUG1("mapped to %03x, new state %04x", item->m_button, currentState); + LOG_VERBOSE("mapped to %03x, new state %04x", item->m_button, currentState); } return item; } @@ -304,9 +304,9 @@ int32_t KeyMap::getLanguageGroupID(int32_t group, const std::string &lang) const if (auto it = std::find(m_keyboardLayouts.begin(), m_keyboardLayouts.end(), lang); it != m_keyboardLayouts.end()) { id = static_cast(std::distance(m_keyboardLayouts.begin(), it)); - LOG_DEBUG1("language %s has group id %d", lang.c_str(), id); + LOG_VERBOSE("language %s has group id %d", lang.c_str(), id); } else { - LOG_DEBUG1("could not found requested language"); + LOG_VERBOSE("could not found requested language"); } return id; @@ -481,7 +481,7 @@ const KeyMap::KeyItem *KeyMap::mapCommandKey( KeyIDMap::const_iterator i = m_keyIDMap.find(id); if (i == m_keyIDMap.end()) { // unknown key - LOG_DEBUG1("key %04x is not on keyboard", id); + LOG_VERBOSE("key %04x is not on keyboard", id); return nullptr; } const KeyGroupTable &keyGroupTable = i->second; @@ -506,7 +506,7 @@ const KeyMap::KeyItem *KeyMap::mapCommandKey( KeyModifierMask requiredIgnoreShiftMask = item.m_required & ~KeyModifierShift; if ((item.m_required & desiredShiftMask) == (item.m_sensitive & desiredShiftMask) && ((requiredIgnoreShiftMask & desiredMask) == requiredIgnoreShiftMask)) { - LOG_DEBUG1("found key in group %d", effectiveGroup); + LOG_VERBOSE("found key in group %d", effectiveGroup); keyItem = &item; break; } @@ -517,7 +517,7 @@ const KeyMap::KeyItem *KeyMap::mapCommandKey( } if (!keyItem) { // no mapping for this keysym - LOG_DEBUG1("no mapping for key %04x", id); + LOG_VERBOSE("no mapping for key %04x", id); return nullptr; } @@ -533,14 +533,14 @@ const KeyMap::KeyItem *KeyMap::mapCommandKey( if (!keysForKeyItem( *keyItem, newGroup, newModifiers, newState, desiredMask, s_overrideModifiers, isAutoRepeat, keys, lang )) { - LOG_DEBUG1("can't map key"); + LOG_VERBOSE("can't map key"); keys.clear(); return nullptr; } // add keystrokes to restore modifier keys if (!keysToRestoreModifiers(*keyItem, group, newModifiers, newState, activeModifiers, keys)) { - LOG_DEBUG1("modifiers were not restored"); + LOG_VERBOSE("modifiers were not restored"); keys.clear(); return nullptr; } @@ -562,7 +562,7 @@ KeyMap::getKeyItemList(const KeyMap::KeyGroupTable &keyGroupTable, int32_t group const auto effectiveGroup = getEffectiveGroup(group, groupOffset); auto keyIndex = findBestKey(keyGroupTable[effectiveGroup], desiredMask); if (keyIndex != -1) { - LOG_DEBUG1("found key in group %d", effectiveGroup); + LOG_VERBOSE("found key in group %d", effectiveGroup); itemList = &keyGroupTable[effectiveGroup][keyIndex]; break; } @@ -580,7 +580,7 @@ const KeyMap::KeyItem *KeyMap::mapCharacterKey( KeyIDMap::const_iterator i = m_keyIDMap.find(id); if (i == m_keyIDMap.end()) { // unknown key - LOG_DEBUG1("key %04x is not on keyboard", id); + LOG_VERBOSE("key %04x is not on keyboard", id); return nullptr; } @@ -589,7 +589,7 @@ const KeyMap::KeyItem *KeyMap::mapCharacterKey( const auto itemList = getKeyItemList(i->second, getLanguageGroupID(group, lang), desiredMask); if (!itemList || itemList->empty()) { // no mapping for this keysym - LOG_DEBUG1("no mapping for key %04x", id); + LOG_VERBOSE("no mapping for key %04x", id); return nullptr; } @@ -603,7 +603,7 @@ const KeyMap::KeyItem *KeyMap::mapCharacterKey( // add each key for (auto &item : *itemList) { if (!keysForKeyItem(item, newGroup, newModifiers, newState, desiredMask, 0, isAutoRepeat, keys, lang)) { - LOG_DEBUG1("can't map key"); + LOG_VERBOSE("can't map key"); keys.clear(); return nullptr; } @@ -611,7 +611,7 @@ const KeyMap::KeyItem *KeyMap::mapCharacterKey( // add keystrokes to restore modifier keys if (!keysToRestoreModifiers(keyItem, group, newModifiers, newState, activeModifiers, keys)) { - LOG_DEBUG1("modifiers were not restored"); + LOG_VERBOSE("modifiers were not restored"); keys.clear(); return nullptr; } @@ -644,7 +644,7 @@ int32_t KeyMap::findBestKey(const KeyEntryList &entryList, KeyModifierMask desir const KeyItem &item = entryList[i].back(); if ((item.m_required & desiredState) == item.m_required && (item.m_required & desiredState) == (item.m_sensitive & desiredState)) { - LOG_DEBUG1("best key index %d of %d (exact)", i + 1, entryList.size()); + LOG_VERBOSE("best key index %d of %d (exact)", i + 1, entryList.size()); return i; } } @@ -662,7 +662,7 @@ int32_t KeyMap::findBestKey(const KeyEntryList &entryList, KeyModifierMask desir } } if (bestIndex != -1) { - LOG_DEBUG1("best key index %d of %d (%d modifiers)", bestIndex + 1, entryList.size(), bestCount); + LOG_VERBOSE("best key index %d of %d (%d modifiers)", bestIndex + 1, entryList.size(), bestCount); } return bestIndex; @@ -708,7 +708,7 @@ bool KeyMap::keysForKeyItem( keyItem.m_button, group, activeModifiers, currentState, keyItem.m_required, keyItem.m_sensitive, 0, keystrokes )) { - LOG_DEBUG1("unable to match modifier state for dead key %d", keyItem.m_button); + LOG_VERBOSE("unable to match modifier state for dead key %d", keyItem.m_button); return false; } @@ -726,13 +726,13 @@ bool KeyMap::keysForKeyItem( // button (any other button) mapped to the shift modifier and then // the Shift_L button. // match key's required state - LOG_DEBUG1("state: %04x,%04x,%04x", currentState, keyItem.m_required, sensitive); + LOG_VERBOSE("state: %04x,%04x,%04x", currentState, keyItem.m_required, sensitive); if (!keysForModifierState( keyItem.m_button, group, activeModifiers, currentState, keyItem.m_required, sensitive, 0, keystrokes )) { LOG( - (CLOG_DEBUG1 "unable to match modifier state (%04x,%04x) for key %d", keyItem.m_required, keyItem.m_sensitive, - keyItem.m_button) + (CLOG_VERBOSE "unable to match modifier state (%04x,%04x) for key %d", keyItem.m_required, + keyItem.m_sensitive, keyItem.m_button) ); return false; } @@ -741,7 +741,7 @@ bool KeyMap::keysForKeyItem( // change any modifiers in keyItem.m_sensitive. and if the key // is a modifier, we don't want to change that modifier. LOG( - (CLOG_DEBUG1 "desired state: %04x %04x,%04x,%04x", desiredState, currentState, keyItem.m_required, + (CLOG_VERBOSE "desired state: %04x %04x,%04x,%04x", desiredState, currentState, keyItem.m_required, keyItem.m_sensitive) ); if (!keysForModifierState( @@ -749,7 +749,7 @@ bool KeyMap::keysForKeyItem( s_notRequiredMask, keystrokes )) { LOG( - (CLOG_DEBUG1 "unable to match desired modifier state (%04x,%04x) for key %d", desiredState, + (CLOG_VERBOSE "unable to match desired modifier state (%04x,%04x) for key %d", desiredState, ~keyItem.m_sensitive & 0xffffu, keyItem.m_button) ); return false; @@ -819,7 +819,7 @@ bool KeyMap::keysForModifierState( // interfere) so we don't try to match at all. flipMask &= ~notRequiredMask; LOG( - (CLOG_DEBUG1 "flip: %04x (%04x vs %04x in %04x - %04x)", flipMask, currentState, requiredState, + (CLOG_VERBOSE "flip: %04x (%04x vs %04x in %04x - %04x)", flipMask, currentState, requiredState, sensitiveMask & 0xffffu, notRequiredMask & 0xffffu) ); if (flipMask == 0) { @@ -847,7 +847,7 @@ bool KeyMap::keysForModifierState( const KeyItem *keyItem = keyForModifier(button, group, bit); if (keyItem == nullptr) { if ((mask & notRequiredMask) == 0) { - LOG_DEBUG1("no key for modifier %04x", mask); + LOG_VERBOSE("no key for modifier %04x", mask); return false; } else { continue; @@ -861,13 +861,13 @@ bool KeyMap::keysForModifierState( if ((sensitive & mask) != 0) { // modifier is sensitive to itself. that makes no sense // so ignore it. - LOG_DEBUG1("modifier %04x modified by itself", mask); + LOG_VERBOSE("modifier %04x modified by itself", mask); sensitive &= ~mask; } if (sensitive != 0) { if (sensitive > mask) { // our assumption is incorrect - LOG_DEBUG1("modifier %04x modified by %04x", mask, sensitive); + LOG_VERBOSE("modifier %04x modified by %04x", mask, sensitive); return false; } if (active && @@ -887,8 +887,8 @@ bool KeyMap::keysForModifierState( // current state should match required state if ((currentState & sensitive) != (keyItem->m_required & sensitive)) { LOG( - (CLOG_DEBUG1 "unable to match modifier state for modifier %04x (%04x " - "vs %04x in %04x)", + (CLOG_VERBOSE "unable to match modifier state for modifier %04x (%04x " + "vs %04x in %04x)", mask, currentState, keyItem->m_required, sensitive) ); return false; diff --git a/src/lib/deskflow/KeyState.cpp b/src/lib/deskflow/KeyState.cpp index d92407602..721bafd46 100644 --- a/src/lib/deskflow/KeyState.cpp +++ b/src/lib/deskflow/KeyState.cpp @@ -684,7 +684,7 @@ void KeyState::onKey(KeyButton button, bool down, KeyModifierMask newState) { // update modifier state m_mask = newState; - LOG_DEBUG1("new mask: 0x%04x", m_mask); + LOG_VERBOSE("new mask: 0x%04x", m_mask); // ignore bogus buttons button &= kButtonMask; @@ -767,7 +767,7 @@ void KeyState::updateKeyState() AddActiveModifierContext addModifierContext(pollActiveGroup(), m_mask, m_activeModifiers); m_keyMap.foreachKey(&KeyState::addActiveModifierCB, &addModifierContext); - LOG_DEBUG1("modifiers on update: 0x%04x", m_mask); + LOG_VERBOSE("modifiers on update: 0x%04x", m_mask); } void KeyState::addActiveModifierCB(KeyID, int32_t group, deskflow::KeyMap::KeyItem &keyItem, void *vcontext) @@ -804,7 +804,7 @@ void KeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID, c // ignore certain keys if (isIgnoredKey(id, mask)) { - LOG_DEBUG1("ignored key %04x %04x", id, mask); + LOG_VERBOSE("ignored key %04x %04x", id, mask); return; } @@ -818,7 +818,7 @@ void KeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID, c // special way if (id == kKeyAudioDown || id == kKeyAudioUp || id == kKeyAudioMute || id == kKeyAudioPlay || id == kKeyAudioPrev || id == kKeyAudioNext || id == kKeyBrightnessDown || id == kKeyBrightnessUp) { - LOG_DEBUG1("emulating media key"); + LOG_VERBOSE("emulating media key"); fakeMediaKey(id); } @@ -841,7 +841,7 @@ void KeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID, c bool KeyState::fakeKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton serverID, const std::string &lang) { - LOG_DEBUG2("fakeKeyRepeat"); + LOG_VERBOSE("fakeKeyRepeat"); serverID &= kButtonMask; // if we haven't seen this button go down then ignore it @@ -927,7 +927,7 @@ bool KeyState::fakeKeyUp(KeyButton serverID) if (!m_activeModifiers.contains(mask)) { // no key for modifier is down so deactivate modifier m_mask &= ~mask; - LOG_DEBUG1("new state %04x", m_mask); + LOG_VERBOSE("new state %04x", m_mask); } } else { ++i; @@ -1086,7 +1086,7 @@ void KeyState::fakeKeys(const Keystrokes &keys, uint32_t count) // next key ++k; } else { - LOG_DEBUG1("skipping keystroke, language sync is disabled"); + LOG_VERBOSE("skipping keystroke, language sync is disabled"); ++k; } } diff --git a/src/lib/deskflow/ProtocolUtil.cpp b/src/lib/deskflow/ProtocolUtil.cpp index fcdbd4a68..7adea9372 100644 --- a/src/lib/deskflow/ProtocolUtil.cpp +++ b/src/lib/deskflow/ProtocolUtil.cpp @@ -71,7 +71,7 @@ void ProtocolUtil::writef(deskflow::IStream *stream, const char *fmt, ...) { assert(stream != nullptr); assert(fmt != nullptr); - LOG_DEBUG2("writef(%s)", fmt); + LOG_VERBOSE("writef(%s)", fmt); va_list args; va_start(args, fmt); @@ -87,7 +87,7 @@ bool ProtocolUtil::readf(deskflow::IStream *stream, const char *fmt, ...) bool result = false; if (stream && fmt) { - LOG_DEBUG2("readf(%s)", fmt); + LOG_VERBOSE("readf(%s)", fmt); va_list args; va_start(args, fmt); try { @@ -121,9 +121,9 @@ void ProtocolUtil::vwritef(deskflow::IStream *stream, const char *fmt, uint32_t try { // write buffer stream->write(Buffer.data(), size); - LOG_DEBUG2("wrote %d bytes", size); + LOG_VERBOSE("wrote %d bytes", size); } catch (const BaseException &exception) { - LOG_DEBUG2("exception <%s> during wrote %d bytes into stream", exception.what(), size); + LOG_VERBOSE("exception <%s> during wrote %d bytes into stream", exception.what(), size); throw; } } @@ -217,7 +217,7 @@ void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list ar // verify match if (buffer[0] != *fmt) { - LOG_DEBUG2("readf: format mismatch: %c vs %c", *fmt, buffer[0]); + LOG_VERBOSE("readf: format mismatch: %c vs %c", *fmt, buffer[0]); throw XIOReadMismatch(); } @@ -429,7 +429,7 @@ void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, uint32_t count // bail if stream has hungup if (n == 0) { - LOG_DEBUG2("unexpected disconnect in readf(), %d bytes left", count); + LOG_VERBOSE("unexpected disconnect in readf(), %d bytes left", count); throw IOEndOfStreamException(); } @@ -446,7 +446,7 @@ uint8_t ProtocolUtil::read1ByteInt(deskflow::IStream *stream) read(stream, buffer.data(), BufferSize); uint8_t Result = buffer[0]; - LOG_DEBUG2("readf: read 1 byte integer: %d (0x%x)", Result, Result); + LOG_VERBOSE("readf: read 1 byte integer: %d (0x%x)", Result, Result); return Result; } @@ -458,7 +458,7 @@ uint16_t ProtocolUtil::read2BytesInt(deskflow::IStream *stream) read(stream, buffer.data(), BufferSize); auto Result = static_cast((static_cast(buffer[0]) << 8) | static_cast(buffer[1])); - LOG_DEBUG2("readf: read 2 byte integer: %d (0x%x)", Result, Result); + LOG_VERBOSE("readf: read 2 byte integer: %d (0x%x)", Result, Result); return Result; } @@ -472,7 +472,7 @@ uint32_t ProtocolUtil::read4BytesInt(deskflow::IStream *stream) uint32_t Result = (static_cast(buffer[0]) << 24) | (static_cast(buffer[1]) << 16) | (static_cast(buffer[2]) << 8) | (static_cast(buffer[3])); - LOG_DEBUG2("readf: read 4 byte integer: %d (0x%x)", Result, Result); + LOG_VERBOSE("readf: read 4 byte integer: %d (0x%x)", Result, Result); return Result; } @@ -550,7 +550,7 @@ void ProtocolUtil::readBytes(deskflow::IStream *stream, uint32_t len, std::strin throw; } - LOG_DEBUG2("readf: read %d byte string", len); + LOG_VERBOSE("readf: read %d byte string", len); // save the data diff --git a/src/lib/deskflow/Screen.cpp b/src/lib/deskflow/Screen.cpp index 0483fa1ad..d0cecc11a 100644 --- a/src/lib/deskflow/Screen.cpp +++ b/src/lib/deskflow/Screen.cpp @@ -289,21 +289,21 @@ void Screen::setOptions(const OptionsList &options) } else { m_halfDuplex &= ~KeyModifierCapsLock; } - LOG_DEBUG1("half-duplex caps-lock %s", ((m_halfDuplex & KeyModifierCapsLock) != 0) ? "on" : "off"); + LOG_VERBOSE("half-duplex caps-lock %s", ((m_halfDuplex & KeyModifierCapsLock) != 0) ? "on" : "off"); } else if (options[i] == kOptionHalfDuplexNumLock) { if (options[i + 1] != 0) { m_halfDuplex |= KeyModifierNumLock; } else { m_halfDuplex &= ~KeyModifierNumLock; } - LOG_DEBUG1("half-duplex num-lock %s", ((m_halfDuplex & KeyModifierNumLock) != 0) ? "on" : "off"); + LOG_VERBOSE("half-duplex num-lock %s", ((m_halfDuplex & KeyModifierNumLock) != 0) ? "on" : "off"); } else if (options[i] == kOptionHalfDuplexScrollLock) { if (options[i + 1] != 0) { m_halfDuplex |= KeyModifierScrollLock; } else { m_halfDuplex &= ~KeyModifierScrollLock; } - LOG_DEBUG1("half-duplex scroll-lock %s", ((m_halfDuplex & KeyModifierScrollLock) != 0) ? "on" : "off"); + LOG_VERBOSE("half-duplex scroll-lock %s", ((m_halfDuplex & KeyModifierScrollLock) != 0) ? "on" : "off"); } } diff --git a/src/lib/deskflow/ServerApp.cpp b/src/lib/deskflow/ServerApp.cpp index cf6afd2bb..d6726a919 100644 --- a/src/lib/deskflow/ServerApp.cpp +++ b/src/lib/deskflow/ServerApp.cpp @@ -262,7 +262,7 @@ void ServerApp::retryHandler() break; case Initializing: - LOG_DEBUG1("retry server initialization"); + LOG_VERBOSE("retry server initialization"); m_serverState = Uninitialized; if (!initServer()) { getEvents()->addEvent(Event(EventTypes::Quit)); @@ -270,12 +270,12 @@ void ServerApp::retryHandler() break; case InitializingToStart: - LOG_DEBUG1("retry server initialization"); + LOG_VERBOSE("retry server initialization"); m_serverState = Uninitialized; if (!initServer()) { getEvents()->addEvent(Event(EventTypes::Quit)); } else if (m_serverState == Initialized) { - LOG_DEBUG1("starting server"); + LOG_VERBOSE("starting server"); if (!startServer()) { getEvents()->addEvent(Event(EventTypes::Quit)); } @@ -283,7 +283,7 @@ void ServerApp::retryHandler() break; case Starting: - LOG_DEBUG1("retry starting server"); + LOG_VERBOSE("retry starting server"); m_serverState = Initialized; if (!startServer()) { getEvents()->addEvent(Event(EventTypes::Quit)); @@ -416,7 +416,7 @@ deskflow::Screen *ServerApp::createScreen() PrimaryClient *ServerApp::openPrimaryClient(const std::string &name, deskflow::Screen *screen) { - LOG_DEBUG1("creating primary screen"); + LOG_VERBOSE("creating primary screen"); return new PrimaryClient(name, screen); } @@ -553,7 +553,7 @@ int ServerApp::mainLoop() void ServerApp::resetServer() { - LOG_DEBUG1("resetting server"); + LOG_VERBOSE("resetting server"); stopServer(); cleanupServer(); startServer(); @@ -589,7 +589,7 @@ void ServerApp::startNode() { // start the server. if this return false then we've failed and // we shouldn't retry. - LOG_DEBUG1("starting server"); + LOG_VERBOSE("starting server"); if (!startServer()) { bye(s_exitFailed); } diff --git a/src/lib/deskflow/ipc/IpcServer.cpp b/src/lib/deskflow/ipc/IpcServer.cpp index beef1f77c..beb5bbd02 100644 --- a/src/lib/deskflow/ipc/IpcServer.cpp +++ b/src/lib/deskflow/ipc/IpcServer.cpp @@ -61,7 +61,7 @@ void IpcServer::handleNewConnection() void IpcServer::handleReadyRead() { const auto clientSocket = qobject_cast(sender()); - LOG_DEBUG1("%s ipc server ready to read data", m_typeName.constData()); + LOG_VERBOSE("%s ipc server ready to read data", m_typeName.constData()); QByteArray data = clientSocket->readAll(); if (data.isEmpty()) { @@ -103,7 +103,7 @@ void IpcServer::handleErrorOccurred() void IpcServer::processMessage(QLocalSocket *clientSocket, const QString &message) { - LOG_DEBUG1("%s ipc server got message: %s", m_typeName.constData(), message.toUtf8().constData()); + LOG_VERBOSE("%s ipc server got message: %s", m_typeName.constData(), message.toUtf8().constData()); const auto parts = message.split('='); if (parts.isEmpty()) { LOG_ERR("%s ipc server got invalid message: %s", m_typeName.constData(), message.toUtf8().constData()); @@ -138,9 +138,9 @@ void IpcServer::processMessage(QLocalSocket *clientSocket, const QString &messag writeToClientSocket(clientSocket, QStringLiteral("hello=%1").arg(versionId)); // Replay messages that were queued before any clients connected. - LOG_DEBUG1("ipc server replaying %d pending messages", m_pendingMessages.size()); + LOG_VERBOSE("ipc server replaying %d pending messages", m_pendingMessages.size()); for (const auto &pending : std::as_const(m_pendingMessages)) { - LOG_DEBUG1("%s ipc server replaying: %s", m_typeName.constData(), pending.toUtf8().constData()); + LOG_VERBOSE("%s ipc server replaying: %s", m_typeName.constData(), pending.toUtf8().constData()); writeToClientSocket(clientSocket, pending); } m_pendingMessages.clear(); @@ -159,14 +159,14 @@ void IpcServer::broadcastCommand(const QString &command, const QString &args) const auto message = args.isEmpty() ? command : QStringLiteral("%1=%2").arg(command, args); if (m_clients.isEmpty()) { - LOG_DEBUG1( + LOG_VERBOSE( "%s ipc server has no clients, message queued: %s", m_typeName.constData(), message.toUtf8().constData() ); m_pendingMessages.append(message); return; } - LOG_DEBUG1( + LOG_VERBOSE( "%s ipc server broadcasting message to %d clients: %s", m_typeName.constData(), m_clients.size(), message.toUtf8().constData() ); @@ -183,7 +183,7 @@ void IpcServer::writeToClientSocket(QLocalSocket *&clientSocket, const QString & if (bytesWritten != messageData.size()) { LOG_ERR("%s ipc server failed to write full message to client socket", m_typeName.constData()); } else { - LOG_DEBUG1( + LOG_VERBOSE( "%s ipc server wrote message to client socket: %s", m_typeName.constData(), message.toUtf8().constData() ); } diff --git a/src/lib/deskflow/unix/X11LayoutsParser.cpp b/src/lib/deskflow/unix/X11LayoutsParser.cpp index 1f70709c6..b86518bf6 100644 --- a/src/lib/deskflow/unix/X11LayoutsParser.cpp +++ b/src/lib/deskflow/unix/X11LayoutsParser.cpp @@ -174,7 +174,7 @@ std::string X11LayoutsParser::convertLayoutToISO( ) { if (layoutLangCode.empty()) { - LOG_DEBUG1("skip converting empty layout lang code"); + LOG_VERBOSE("skip converting empty layout lang code"); return ""; } diff --git a/src/lib/gui/dialogs/SettingsDialog.cpp b/src/lib/gui/dialogs/SettingsDialog.cpp index a5d7ab4e2..b491630c1 100644 --- a/src/lib/gui/dialogs/SettingsDialog.cpp +++ b/src/lib/gui/dialogs/SettingsDialog.cpp @@ -205,8 +205,7 @@ void SettingsDialog::updateText() ui->comboLogLevel->setItemData(2, tr("General warnings"), Qt::ToolTipRole); ui->comboLogLevel->setItemData(3, tr("General events [Default]"), Qt::ToolTipRole); ui->comboLogLevel->setItemData(4, tr("Debug entries"), Qt::ToolTipRole); - ui->comboLogLevel->setItemData(5, tr("More debug output"), Qt::ToolTipRole); - ui->comboLogLevel->setItemData(6, tr("Verbose debug output"), Qt::ToolTipRole); + ui->comboLogLevel->setItemData(5, tr("Verbose debug output"), Qt::ToolTipRole); ui->buttonBox->button(QDialogButtonBox::Save)->setToolTip(tr("Close and save changes")); ui->buttonBox->button(QDialogButtonBox::Cancel)->setToolTip(tr("Close and forget changes")); ui->buttonBox->button(QDialogButtonBox::Reset)->setToolTip(tr("Reset to stored values")); diff --git a/src/lib/gui/dialogs/SettingsDialog.ui b/src/lib/gui/dialogs/SettingsDialog.ui index 0e53615ee..f15554cf5 100644 --- a/src/lib/gui/dialogs/SettingsDialog.ui +++ b/src/lib/gui/dialogs/SettingsDialog.ui @@ -328,18 +328,23 @@ - Debug1 - - - - - Debug2 + Trace + + + + Using a log level higher than Info may affect performance. + + + true + + + @@ -447,16 +452,6 @@ - - - - Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report. - - - true - - - diff --git a/src/lib/mt/Thread.cpp b/src/lib/mt/Thread.cpp index 702b80fdb..9ddfc110f 100644 --- a/src/lib/mt/Thread.cpp +++ b/src/lib/mt/Thread.cpp @@ -125,18 +125,18 @@ void *Thread::threadFunc(void *vjob) void *result = nullptr; try { // go - LOG_DEBUG1("thread 0x%08x entry", id); + LOG_VERBOSE("thread 0x%08x entry", id); job->run(); - LOG_DEBUG1("thread 0x%08x exit", id); + LOG_VERBOSE("thread 0x%08x exit", id); } catch (ThreadCancelException &) { // client called cancel() - LOG_DEBUG1("caught cancel on thread 0x%08x", id); + LOG_VERBOSE("caught cancel on thread 0x%08x", id); delete job; throw; } catch (ThreadExitException &e) { // client called exit() result = e.m_result; - LOG_DEBUG1("caught exit on thread 0x%08x, result %p", id, result); + LOG_VERBOSE("caught exit on thread 0x%08x, result %p", id, result); } catch (BaseException &e) { LOG_ERR("exception on thread 0x%08x: %s", id, e.what()); delete job; diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index 52460755f..365f46b67 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -229,7 +229,7 @@ int SecureSocket::secureRead(void *buffer, int size, int &read) std::scoped_lock ssl_lock{ssl_mutex_}; if (m_ssl->m_ssl != nullptr) { - LOG_DEBUG2("reading secure socket"); + LOG_VERBOSE("reading secure socket"); read = SSL_read(m_ssl->m_ssl, buffer, size); static int retry; @@ -256,7 +256,7 @@ int SecureSocket::secureWrite(const void *buffer, int size, int &wrote) std::scoped_lock ssl_lock{ssl_mutex_}; if (m_ssl->m_ssl != nullptr) { - LOG_DEBUG2("writing secure socket: %p", this); + LOG_VERBOSE("writing secure socket: %p", this); wrote = SSL_write(m_ssl->m_ssl, buffer, size); @@ -415,7 +415,7 @@ int SecureSocket::secureAccept(int socket) // set connection socket to SSL state SSL_set_fd(m_ssl->m_ssl, socket); - LOG_DEBUG2("accepting secure socket"); + LOG_VERBOSE("accepting secure socket"); int r = SSL_accept(m_ssl->m_ssl); static int retry; @@ -447,7 +447,7 @@ int SecureSocket::secureAccept(int socket) // If not fatal and retry is set, not ready, and return retry if (retry > 0) { - LOG_DEBUG2("retry accepting secure socket"); + LOG_VERBOSE("retry accepting secure socket"); m_secureReady = false; return 0; } @@ -472,7 +472,7 @@ int SecureSocket::secureConnect(int socket) // attach the socket descriptor SSL_set_fd(m_ssl->m_ssl, socket); - LOG_DEBUG2("connecting secure socket"); + LOG_VERBOSE("connecting secure socket"); // enable hostname verification. const auto name = Settings::value(Settings::Core::ComputerName).toString().toStdString(); @@ -491,7 +491,7 @@ int SecureSocket::secureConnect(int socket) // If we should retry, not ready and return 0 if (retry > 0) { - LOG_DEBUG2("retry connect secure socket"); + LOG_VERBOSE("retry connect secure socket"); m_secureReady = false; return 0; } @@ -510,7 +510,7 @@ int SecureSocket::secureConnect(int socket) disconnect(); return -1; // Fingerprint failed, error } - LOG_DEBUG2("connected secure socket"); + LOG_VERBOSE("connected secure socket"); SslLogger::logSecureCipherInfo(m_ssl->m_ssl); SslLogger::logSecureConnectInfo(m_ssl->m_ssl); return 1; @@ -555,7 +555,7 @@ void SecureSocket::checkResult(int status, int &retry) case SSL_ERROR_WANT_READ: setReadable(true); retry++; - LOG_DEBUG2("want to read, error=%d, attempt=%d", errorCode, retry); + LOG_VERBOSE("want to read, error=%d, attempt=%d", errorCode, retry); break; case SSL_ERROR_WANT_WRITE: @@ -563,17 +563,17 @@ void SecureSocket::checkResult(int status, int &retry) // poll action actually triggers on a write. setWritable(true); retry++; - LOG_DEBUG2("want to write, error=%d, attempt=%d", errorCode, retry); + LOG_VERBOSE("want to write, error=%d, attempt=%d", errorCode, retry); break; case SSL_ERROR_WANT_CONNECT: retry++; - LOG_DEBUG2("want to connect, error=%d, attempt=%d", errorCode, retry); + LOG_VERBOSE("want to connect, error=%d, attempt=%d", errorCode, retry); break; case SSL_ERROR_WANT_ACCEPT: retry++; - LOG_DEBUG2("want to accept, error=%d, attempt=%d", errorCode, retry); + LOG_VERBOSE("want to accept, error=%d, attempt=%d", errorCode, retry); break; case SSL_ERROR_SYSCALL: diff --git a/src/lib/net/SslLogger.cpp b/src/lib/net/SslLogger.cpp index 4bc037064..aedbefeab 100644 --- a/src/lib/net/SslLogger.cpp +++ b/src/lib/net/SslLogger.cpp @@ -27,7 +27,7 @@ void showCipherStackDesc(STACK_OF(SSL_CIPHER) * stack) msg[pos] = '\0'; } - LOG_DEBUG1("%s", msg); + LOG_VERBOSE("%s", msg); } } @@ -36,10 +36,10 @@ void logLocalSecureCipherInfo(const SSL *ssl) auto sStack = SSL_get_ciphers(ssl); if (sStack) { - LOG_DEBUG1("available local ciphers:"); + LOG_VERBOSE("available local ciphers:"); showCipherStackDesc(sStack); } else { - LOG_DEBUG1("local cipher list not available"); + LOG_VERBOSE("local cipher list not available"); } } @@ -55,10 +55,10 @@ void logRemoteSecureCipherInfo(const SSL *ssl) auto cStack = SSL_get_client_ciphers(ssl); #endif if (cStack) { - LOG_DEBUG1("available remote ciphers:"); + LOG_VERBOSE("available remote ciphers:"); showCipherStackDesc(cStack); } else { - LOG_DEBUG1("remote cipher list not available"); + LOG_VERBOSE("remote cipher list not available"); } } @@ -68,16 +68,16 @@ void SslLogger::logSecureLibInfo() { if (CLOG->getFilter() >= LogLevel::Debug) { LOG_DEBUG("openssl version: %s", SSLeay_version(SSLEAY_VERSION)); - LOG_DEBUG1("openssl flags: %s", SSLeay_version(SSLEAY_CFLAGS)); - LOG_DEBUG1("openssl built on: %s", SSLeay_version(SSLEAY_BUILT_ON)); - LOG_DEBUG1("openssl platform: %s", SSLeay_version(SSLEAY_PLATFORM)); - LOG_DEBUG1("openssl dir: %s", SSLeay_version(SSLEAY_DIR)); + LOG_VERBOSE("openssl flags: %s", SSLeay_version(SSLEAY_CFLAGS)); + LOG_VERBOSE("openssl built on: %s", SSLeay_version(SSLEAY_BUILT_ON)); + LOG_VERBOSE("openssl platform: %s", SSLeay_version(SSLEAY_PLATFORM)); + LOG_VERBOSE("openssl dir: %s", SSLeay_version(SSLEAY_DIR)); } } void SslLogger::logSecureCipherInfo(const SSL *ssl) { - if (ssl && CLOG->getFilter() >= LogLevel::Debug1) { + if (ssl && CLOG->getFilter() >= LogLevel::Verbose) { logLocalSecureCipherInfo(ssl); logRemoteSecureCipherInfo(ssl); } @@ -144,19 +144,19 @@ void SslLogger::logErrorByCode(int code, int retry) break; case SSL_ERROR_WANT_READ: - LOG_DEBUG2("want to read, error=%d, attempt=%d", code, retry); + LOG_VERBOSE("want to read, error=%d, attempt=%d", code, retry); break; case SSL_ERROR_WANT_WRITE: - LOG_DEBUG2("want to write, error=%d, attempt=%d", code, retry); + LOG_VERBOSE("want to write, error=%d, attempt=%d", code, retry); break; case SSL_ERROR_WANT_CONNECT: - LOG_DEBUG2("want to connect, error=%d, attempt=%d", code, retry); + LOG_VERBOSE("want to connect, error=%d, attempt=%d", code, retry); break; case SSL_ERROR_WANT_ACCEPT: - LOG_DEBUG2("want to accept, error=%d, attempt=%d", code, retry); + LOG_VERBOSE("want to accept, error=%d, attempt=%d", code, retry); break; case SSL_ERROR_SYSCALL: diff --git a/src/lib/platform/EiEventQueueBuffer.cpp b/src/lib/platform/EiEventQueueBuffer.cpp index db7e55ce4..881b3bab5 100644 --- a/src/lib/platform/EiEventQueueBuffer.cpp +++ b/src/lib/platform/EiEventQueueBuffer.cpp @@ -77,7 +77,7 @@ void EiEventQueueBuffer::waitForEvent(double msTimeout) while ((result = read(m_pipeRead, buf, sizeof(buf)) > 0)) { total += result; } - LOG_DEBUG2("event queue read result: %d (total drained: %zd)", result, total); + LOG_VERBOSE("event queue read result: %d (total drained: %zd)", result, total); } } Thread::testCancel(); @@ -120,7 +120,7 @@ bool EiEventQueueBuffer::addEvent(uint32_t dataID) // tickle the pipe so our read thread wakes up auto result = write(m_pipeWrite, "!", 1); - LOG_DEBUG2("event queue write result: %d", result); + LOG_VERBOSE("event queue write result: %d", result); return true; } diff --git a/src/lib/platform/EiKeyState.cpp b/src/lib/platform/EiKeyState.cpp index 473ae6659..5c63214c4 100644 --- a/src/lib/platform/EiKeyState.cpp +++ b/src/lib/platform/EiKeyState.cpp @@ -178,7 +178,7 @@ std::uint32_t EiKeyState::convertModMask(xkb_mod_mask_t xkbModMaskIn) const (strcmp(XKB_MOD_NAME_MOD2, name) == 0) || // spare, sometimes mapped to num lock. (strcmp(XKB_MOD_NAME_MOD3, name) == 0) // spare, could be mapped to alt_r, caps lock, scroll lock, etc. ) - LOG_DEBUG2("modifier mask %s ignored", name); + LOG_VERBOSE("modifier mask %s ignored", name); else LOG_WARN("modifier mask %s not accounted for, this is a bug", name); } @@ -245,7 +245,7 @@ void EiKeyState::getKeyMap(deskflow::KeyMap &keyMap) // that shouldn't be sent over the network. They appear in newer // xkeyboard-config on level 5 of function keys with CTRL+ALT type. if (strncmp(keysymName, "XF86_Switch_VT_", 15) == 0) { - LOG_DEBUG2("skipping VT switch keysym %s for keycode %d", keysymName, keycode); + LOG_VERBOSE("skipping VT switch keysym %s for keycode %d", keysymName, keycode); continue; } @@ -305,7 +305,7 @@ void EiKeyState::fakeKey(const Keystroke &keystroke) if (keystroke.m_type != Keystroke::KeyType::Button) return; - LOG_DEBUG1( + LOG_VERBOSE( "fake key: %03x (%08x) %s", keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_client, keystroke.m_data.m_button.m_press ? "down" : "up" ); @@ -333,14 +333,14 @@ KeyID EiKeyState::mapKeyFromKeyval(uint32_t keyval) const auto keysym = static_cast(xkbKeysym); KeyID keyid = XDGKeyUtil::mapKeySymToKeyID(keysym); - LOG_DEBUG1("mapped key: code=%d keysym=0x%04lx to keyID=%d", keyval, keysym, keyid); + LOG_VERBOSE("mapped key: code=%d keysym=0x%04lx to keyID=%d", keyval, keysym, keyid); return keyid; } void EiKeyState::updateXkbState(uint32_t keyval, bool isPressed) { - LOG_DEBUG1("update key state: keyval=%d pressed=%i", keyval, isPressed); + LOG_VERBOSE("update key state: keyval=%d pressed=%i", keyval, isPressed); xkb_state_update_key(m_xkbState, keyval, isPressed ? XKB_KEY_DOWN : XKB_KEY_UP); } diff --git a/src/lib/platform/EiScreen.cpp b/src/lib/platform/EiScreen.cpp index 5ef4c8202..121e9dd1a 100644 --- a/src/lib/platform/EiScreen.cpp +++ b/src/lib/platform/EiScreen.cpp @@ -96,7 +96,7 @@ void EiScreen::eiLogEvent(ei_log_priority priority, const char *message) const { switch (priority) { case EI_LOG_PRIORITY_DEBUG: - LOG_DEBUG1("ei: %s", message); + LOG_VERBOSE("ei: %s", message); break; case EI_LOG_PRIORITY_INFO: LOG_INFO("ei: %s", message); @@ -629,7 +629,7 @@ void EiScreen::onKeyEvent(ei_event *event) m_lastPressed = pressed ? keyid : kKeyNone; - LOG_DEBUG1( + LOG_VERBOSE( "event: key %s%s keycode=%d keyid=%d mask=0x%x", pressed ? "press" : "release", repeat ? " (repeat)" : "", keycode, keyid, mask ); @@ -651,7 +651,7 @@ void EiScreen::onButtonEvent(ei_event *event) bool pressed = ei_event_button_get_is_press(event); KeyModifierMask mask = m_keyState->pollActiveModifiers(); - LOG_DEBUG1("event: button %s button=%d mask=0x%x", pressed ? "press" : "release", buttonID, mask); + LOG_VERBOSE("event: button %s button=%d mask=0x%x", pressed ? "press" : "release", buttonID, mask); if (buttonID == kButtonNone) { LOG_DEBUG("event: button not recognized"); @@ -680,7 +680,7 @@ void EiScreen::onPointerScrollEvent(ei_event *event) auto dy = ei_event_scroll_get_dy(event); struct ei_device *device = ei_event_get_device(event); - LOG_DEBUG1("event: scroll (%.2f, %.2f)", dx, dy); + LOG_VERBOSE("event: scroll (%.2f, %.2f)", dx, dy); auto *remainder = static_cast(ei_device_get_user_data(device)); if (!remainder) { @@ -723,7 +723,7 @@ void EiScreen::onPointerScrollDiscreteEvent(ei_event *event) auto dx = ei_event_scroll_get_discrete_dx(event); auto dy = ei_event_scroll_get_discrete_dy(event); - LOG_DEBUG1("event: scroll discrete (%d, %d)", dx, dy); + LOG_VERBOSE("event: scroll discrete (%d, %d)", dx, dy); // libei and deskflow seem to use opposite directions, so we have // to send the opposite of the value reported by EI if we want to @@ -750,7 +750,7 @@ void EiScreen::onMotionEvent(ei_event *event) auto pixelDx = static_cast(m_bufferDX); auto pixelDy = static_cast(m_bufferDY); if (pixelDx || pixelDy) { - LOG_DEBUG1("event: motion on secondary x=%d y=%d", pixelDx, pixelDy); + LOG_VERBOSE("event: motion on secondary x=%d y=%d", pixelDx, pixelDy); sendEvent(EventTypes::PrimaryScreenMotionOnSecondary, MotionInfo::alloc(pixelDx, pixelDy)); m_bufferDX -= pixelDx; m_bufferDY -= pixelDy; diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index 99b733680..143425a8b 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -188,7 +188,7 @@ void MSWindowsDesks::setOptions(const OptionsList &options) for (uint32_t i = 0, n = (uint32_t)options.size(); i < n; i += 2) { if (options[i] == kOptionWin32KeepForeground) { m_leaveForegroundOption = (options[i + 1] != 0); - LOG_DEBUG1("%s the foreground window", m_leaveForegroundOption ? "don\'t grab" : "grab"); + LOG_VERBOSE("%s the foreground window", m_leaveForegroundOption ? "don\'t grab" : "grab"); } } } @@ -470,20 +470,20 @@ void setCursorVisibility(bool visible) int attempts = 0; while (attempts++ < max) { const auto displayCounter = ShowCursor(visible ? TRUE : FALSE); - LOG_DEBUG1("cursor display counter: %d", displayCounter); + LOG_VERBOSE("cursor display counter: %d", displayCounter); if (visible) { if (displayCounter < 0) { - LOG_DEBUG1("cursor still hidden, retrying, attempt: %d", attempts); + LOG_VERBOSE("cursor still hidden, retrying, attempt: %d", attempts); } else { - LOG_DEBUG1("cursor is now visible, attempts: %d", attempts); + LOG_VERBOSE("cursor is now visible, attempts: %d", attempts); return; } } else { if (displayCounter >= 0) { - LOG_DEBUG1("cursor still visible, retrying, attempt: %d", attempts); + LOG_VERBOSE("cursor still visible, retrying, attempt: %d", attempts); } else { - LOG_DEBUG1("cursor is now hidden, attempts: %d", attempts); + LOG_VERBOSE("cursor is now hidden, attempts: %d", attempts); return; } } @@ -594,7 +594,7 @@ void MSWindowsDesks::deskLeave(Desk *desk, HKL keyLayout) // would be better but 10 ms doesn't seem to be quite long enough, as we get noticeable flicker. // this is largely a balance and out of our control, since windows can be unpredictable... // maybe another approach would be to repeatedly check the cursor visibility until it is hidden. - LOG_DEBUG1("centering cursor on leave: %+d,%+d", m_xCenter, m_yCenter); + LOG_VERBOSE("centering cursor on leave: %+d,%+d", m_xCenter, m_yCenter); ARCH->sleep(0.03); deskMouseMove(m_xCenter, m_yCenter); } diff --git a/src/lib/platform/MSWindowsKeyState.cpp b/src/lib/platform/MSWindowsKeyState.cpp index d17620fa0..4f6d9b8e8 100644 --- a/src/lib/platform/MSWindowsKeyState.cpp +++ b/src/lib/platform/MSWindowsKeyState.cpp @@ -834,7 +834,7 @@ int32_t MSWindowsKeyState::pollActiveGroup() const // get group GroupMap::const_iterator i = m_groupMap.find(hkl); if (i == m_groupMap.end()) { - LOG_DEBUG1("can't find keyboard layout %08x", hkl); + LOG_VERBOSE("can't find keyboard layout %08x", hkl); return 0; } @@ -1165,14 +1165,14 @@ void MSWindowsKeyState::fakeKey(const Keystroke &keystroke) switch (keystroke.m_type) { case Keystroke::KeyType::Button: { LOG( - (CLOG_DEBUG1 " %03x (%08x) %s", keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_client, + (CLOG_VERBOSE " %03x (%08x) %s", keystroke.m_data.m_button.m_button, keystroke.m_data.m_button.m_client, keystroke.m_data.m_button.m_press ? "down" : "up") ); KeyButton scanCode = keystroke.m_data.m_button.m_button; // windows doesn't send key ups for key repeats if (keystroke.m_data.m_button.m_repeat && !keystroke.m_data.m_button.m_press) { - LOG_DEBUG1(" discard key repeat release"); + LOG_VERBOSE(" discard key repeat release"); break; } @@ -1207,10 +1207,10 @@ void MSWindowsKeyState::fakeKey(const Keystroke &keystroke) // key events. if (!keystroke.m_data.m_group.m_restore) { if (keystroke.m_data.m_group.m_absolute) { - LOG_DEBUG1(" group %d", keystroke.m_data.m_group.m_group); + LOG_VERBOSE(" group %d", keystroke.m_data.m_group.m_group); setWindowGroup(keystroke.m_data.m_group.m_group); } else { - LOG_DEBUG1(" group %+d", keystroke.m_data.m_group.m_group); + LOG_VERBOSE(" group %+d", keystroke.m_data.m_group.m_group); setWindowGroup(getEffectiveGroup(pollActiveGroup(), keystroke.m_data.m_group.m_group)); } } @@ -1232,13 +1232,13 @@ bool MSWindowsKeyState::getGroups(GroupList &groups) const // get keyboard layouts uint32_t newNumLayouts = GetKeyboardLayoutList(0, nullptr); if (newNumLayouts == 0) { - LOG_DEBUG1("can't get keyboard layouts"); + LOG_VERBOSE("can't get keyboard layouts"); return false; } HKL *newLayouts = new HKL[newNumLayouts]; newNumLayouts = GetKeyboardLayoutList(newNumLayouts, newLayouts); if (newNumLayouts == 0) { - LOG_DEBUG1("can't get keyboard layouts"); + LOG_VERBOSE("can't get keyboard layouts"); delete[] newLayouts; return false; } diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index f2f5a1646..8874e16b8 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -288,7 +288,7 @@ void MSWindowsScreen::leave() m_desks->leave(m_keyLayout); if (m_isPrimary) { - LOG_DEBUG1("centering cursor on leave: %+d, %+d", m_xCenter, m_yCenter); + LOG_VERBOSE("centering cursor on leave: %+d, %+d", m_xCenter, m_yCenter); warpCursor(m_xCenter, m_yCenter); // disable special key sequences on win95 family @@ -307,7 +307,7 @@ void MSWindowsScreen::leave() for (KeyButton i = 0; i < IKeyState::s_numButtons; ++i) { if (m_keyState->isKeyDown(i)) { m_primaryKeyDownList.push_back(i); - LOG_DEBUG1("key button %d is down before leaving to another screen", i); + LOG_VERBOSE("key button %d is down before leaving to another screen", i); } } } @@ -533,7 +533,7 @@ void MSWindowsScreen::saveMousePosition(int32_t x, int32_t y) m_xCursor = x; m_yCursor = y; - LOG_DEBUG2("saved mouse position for next delta: %+d,%+d", x, y); + LOG_VERBOSE("saved mouse position for next delta: %+d,%+d", x, y); } uint32_t MSWindowsScreen::registerHotKey(KeyID key, KeyModifierMask mask) @@ -867,7 +867,7 @@ bool MSWindowsScreen::onPreDispatch(HWND hwnd, UINT message, WPARAM wParam, LPAR return onScreensaver(wParam != 0); case DESKFLOW_MSG_DEBUG: - LOG_DEBUG1("hook: 0x%08x 0x%08x", wParam, lParam); + LOG_VERBOSE("hook: 0x%08x 0x%08x", wParam, lParam); return true; } @@ -880,7 +880,7 @@ bool MSWindowsScreen::onPreDispatch(HWND hwnd, UINT message, WPARAM wParam, LPAR bool MSWindowsScreen::onPreDispatchPrimary(HWND, UINT message, WPARAM wParam, LPARAM lParam) { - LOG_DEBUG2("handling pre-dispatch primary"); + LOG_VERBOSE("handling pre-dispatch primary"); // handle event switch (message) { @@ -1009,7 +1009,7 @@ bool MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam) { static const KeyModifierMask s_ctrlAlt = KeyModifierControl | KeyModifierAlt; - LOG_DEBUG1( + LOG_VERBOSE( "event: Key char=%d, vk=0x%02x, nagr=%d, lParam=0x%08x", (wParam & 0xffffu), (wParam >> 16) & 0xffu, (wParam & 0x1000000u) ? 1 : 0, lParam ); @@ -1043,7 +1043,7 @@ bool MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam) if (!down && m_isPrimary && !m_isOnScreen) { PrimaryKeyDownList::iterator find = std::find(m_primaryKeyDownList.begin(), m_primaryKeyDownList.end(), button); if (find != m_primaryKeyDownList.end()) { - LOG_DEBUG1("release key button %d on primary", *find); + LOG_VERBOSE("release key button %d on primary", *find); m_hook.setMode(kHOOK_WATCH_JUMP_ZONE); fakeLocalKey(*find, false); m_primaryKeyDownList.erase(find); @@ -1125,7 +1125,7 @@ bool MSWindowsScreen::onKey(WPARAM wParam, LPARAM lParam) (int32_t)(lParam & 0xffff), button ); } else { - LOG_DEBUG1("cannot map key"); + LOG_VERBOSE("cannot map key"); } } @@ -1190,12 +1190,12 @@ bool MSWindowsScreen::onMouseButton(WPARAM wParam, LPARAM lParam) if (!ignore()) { KeyModifierMask mask = m_keyState->getActiveModifiers(); if (pressed) { - LOG_DEBUG1("event: button press button=%d", button); + LOG_VERBOSE("event: button press button=%d", button); if (button != kButtonNone) { sendEvent(EventTypes::PrimaryScreenButtonDown, ButtonInfo::alloc(button, mask)); } } else { - LOG_DEBUG1("event: button release button=%d", button); + LOG_VERBOSE("event: button release button=%d", button); if (button != kButtonNone) { sendEvent(EventTypes::PrimaryScreenButtonUp, ButtonInfo::alloc(button, mask)); } @@ -1222,7 +1222,7 @@ bool MSWindowsScreen::onMouseMove(int32_t mx, int32_t my) int32_t x = mx - m_xCursor; int32_t y = my - m_yCursor; - LOG_DEBUG2("mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)", x, mx, m_xCursor, y, my, m_yCursor); + LOG_VERBOSE("mouse move - motion delta: %+d=(%+d - %+d),%+d=(%+d - %+d)", x, mx, m_xCursor, y, my, m_yCursor); // ignore if the mouse didn't move or if message posted prior // to last mark change. @@ -1241,7 +1241,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_DEBUG2("centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter); + LOG_VERBOSE("centering cursor on motion: %+d,%+d", m_xCenter, m_yCenter); warpCursorNoFlush(m_xCenter, m_yCenter); // examine the motion. if it's about the distance @@ -1267,7 +1267,7 @@ bool MSWindowsScreen::onMouseWheel(int32_t xDelta, int32_t yDelta) { // ignore message if posted prior to last mark change if (!ignore()) { - LOG_DEBUG1("event: button wheel delta=%+d,%+d", xDelta, yDelta); + LOG_VERBOSE("event: button wheel delta=%+d,%+d", xDelta, yDelta); sendEvent(EventTypes::PrimaryScreenWheel, WheelInfo::alloc(xDelta, yDelta)); } return true; @@ -1315,7 +1315,7 @@ bool MSWindowsScreen::onDisplayChange() if (xOld != m_x || yOld != m_y || wOld != m_w || hOld != m_h) { if (m_isPrimary) { if (!m_isOnScreen) { - LOG_DEBUG1("centering cursor on display change: %+d, %+d", m_xCenter, m_yCenter); + LOG_VERBOSE("centering cursor on display change: %+d, %+d", m_xCenter, m_yCenter); warpCursor(m_xCenter, m_yCenter); } @@ -1659,7 +1659,7 @@ void MSWindowsScreen::updateMouseKeys() if (!ok) { LOG_ERR("failed to set mouse keys, error: %d", GetLastError()); } else { - LOG_DEBUG1("mouse keys enabled successfully"); + LOG_VERBOSE("mouse keys enabled successfully"); } } diff --git a/src/lib/platform/MSWindowsScreenSaver.cpp b/src/lib/platform/MSWindowsScreenSaver.cpp index 070fde824..84fbf1c81 100644 --- a/src/lib/platform/MSWindowsScreenSaver.cpp +++ b/src/lib/platform/MSWindowsScreenSaver.cpp @@ -71,7 +71,7 @@ bool MSWindowsScreenSaver::checkStarted(UINT msg, WPARAM wParam, LPARAM lParam) // we first check that the screen saver is indeed active // before watching for it to stop. if (!isActive()) { - LOG_DEBUG2("can't open screen saver desktop"); + LOG_VERBOSE("can't open screen saver desktop"); return false; } diff --git a/src/lib/platform/MSWindowsSession.cpp b/src/lib/platform/MSWindowsSession.cpp index f53715301..6a64e24b1 100644 --- a/src/lib/platform/MSWindowsSession.cpp +++ b/src/lib/platform/MSWindowsSession.cpp @@ -52,7 +52,7 @@ bool MSWindowsSession::isProcessInSession(const wchar_t *name, PHANDLE process = if (!pidToSidRet) { // if we can not acquire session associated with a specified process, // simply ignore it - LOG_DEBUG2( + LOG_VERBOSE( "could not get session id for process: %i %s, code=%i", entry.th32ProcessID, entry.szExeFile, GetLastError() ); gotEntry = nextProcessEntry(snapshot, &entry); @@ -81,7 +81,7 @@ bool MSWindowsSession::isProcessInSession(const wchar_t *name, PHANDLE process = nameListJoin.append(L", "); } - LOG_DEBUG2("processes in session %d: %s", m_activeSessionId, nameListJoin.c_str()); + LOG_VERBOSE("processes in session %d: %s", m_activeSessionId, nameListJoin.c_str()); CloseHandle(snapshot); diff --git a/src/lib/platform/MSWindowsWatchdog.cpp b/src/lib/platform/MSWindowsWatchdog.cpp index 9c7738811..aa1aea7b4 100644 --- a/src/lib/platform/MSWindowsWatchdog.cpp +++ b/src/lib/platform/MSWindowsWatchdog.cpp @@ -159,7 +159,7 @@ void MSWindowsWatchdog::mainLoop(const void *) LOG_DEBUG("starting watchdog main loop"); while (m_running) { - LOG_DEBUG2("locking process state mutex in watchdog main loop"); + LOG_VERBOSE("locking process state mutex in watchdog main loop"); std::unique_lock lock(m_processStateMutex); if (m_processState == Running && !m_command.empty() && !m_foreground && m_session.hasChanged()) { @@ -170,11 +170,11 @@ void MSWindowsWatchdog::mainLoop(const void *) switch (m_processState) { case Idle: - LOG_DEBUG2("watchdog process state idle"); + LOG_VERBOSE("watchdog process state idle"); break; case StartScheduled: { - LOG_DEBUG2("watchdog process start scheduled"); + LOG_VERBOSE("watchdog process start scheduled"); if (m_nextStartTime.has_value() && m_nextStartTime.value() <= Arch::time()) { LOG_DEBUG("start time reached, queueing process start"); m_processState = StartPending; @@ -195,7 +195,7 @@ void MSWindowsWatchdog::mainLoop(const void *) } break; case Running: { - LOG_DEBUG2("watchdog process in running state"); + LOG_VERBOSE("watchdog process in running state"); if (!isProcessRunning()) { LOG_WARN("detected application not running, pid=%d", m_process->info().dwProcessId); m_processState = StartPending; @@ -215,11 +215,11 @@ void MSWindowsWatchdog::mainLoop(const void *) } break; } - LOG_DEBUG2("unlocking process state mutex in watchdog main loop"); + LOG_VERBOSE("unlocking process state mutex in watchdog main loop"); lock.unlock(); // Sleep for only 100ms rather than 1 second so that the service can shut down faster. - LOG_DEBUG2("watchdog main loop sleeping"); + LOG_VERBOSE("watchdog main loop sleeping"); Arch::sleep(0.1); } @@ -298,7 +298,7 @@ void MSWindowsWatchdog::startProcess() } LOG_DEBUG("started core process from watchdog"); - LOG_DEBUG2( + LOG_VERBOSE( "process info, session=%i, elevated=%s, command: %s", // m_session.getActiveSessionId(), m_elevateProcess ? "yes" : "no", m_command.c_str() ); @@ -307,7 +307,7 @@ void MSWindowsWatchdog::startProcess() void MSWindowsWatchdog::setProcessConfig(const std::string_view &command, bool elevate) { - LOG_DEBUG1("locking process state mutex for watchdog config change"); + LOG_VERBOSE("locking process state mutex for watchdog config change"); std::scoped_lock lock{m_processStateMutex}; LOG_DEBUG("setting watchdog process config"); @@ -501,7 +501,7 @@ void MSWindowsWatchdog::initSasFunc() void MSWindowsWatchdog::sasLoop(const void *) // NOSONAR - Thread entry point signature { - LOG_DEBUG2("watchdog creating sas event"); + LOG_VERBOSE("watchdog creating sas event"); if (m_sendSasFunc == nullptr) { throw std::runtime_error("SendSAS function not initialized"); @@ -509,7 +509,7 @@ void MSWindowsWatchdog::sasLoop(const void *) // NOSONAR - Thread entry point si while (m_running) { if (m_processState != ProcessState::Running) { - LOG_DEBUG2("watchdog not running, skipping SendSAS"); + LOG_VERBOSE("watchdog not running, skipping SendSAS"); Arch::sleep(1); continue; } diff --git a/src/lib/platform/OSXClipboard.cpp b/src/lib/platform/OSXClipboard.cpp index 02608108c..b53853075 100644 --- a/src/lib/platform/OSXClipboard.cpp +++ b/src/lib/platform/OSXClipboard.cpp @@ -67,7 +67,7 @@ bool OSXClipboard::synchronize() return false; PasteboardSyncFlags flags = PasteboardSynchronize(m_pboard); - LOG_DEBUG2("flags: %x", flags); + LOG_VERBOSE("flags: %x", flags); if (flags & kPasteboardModified) { return true; diff --git a/src/lib/platform/OSXClipboardBMPConverter.cpp b/src/lib/platform/OSXClipboardBMPConverter.cpp index 637a1cf6d..82eb24157 100644 --- a/src/lib/platform/OSXClipboardBMPConverter.cpp +++ b/src/lib/platform/OSXClipboardBMPConverter.cpp @@ -61,7 +61,7 @@ CFStringRef OSXClipboardBMPConverter::getOSXFormat() const std::string OSXClipboardBMPConverter::fromIClipboard(const std::string &bmp) const { - LOG_DEBUG1("getting data from clipboard"); + LOG_VERBOSE("getting data from clipboard"); // create BMP image uint8_t header[14]; uint8_t *dst = header; diff --git a/src/lib/platform/OSXEventQueueBuffer.cpp b/src/lib/platform/OSXEventQueueBuffer.cpp index ada237c92..e2fafd0ca 100644 --- a/src/lib/platform/OSXEventQueueBuffer.cpp +++ b/src/lib/platform/OSXEventQueueBuffer.cpp @@ -31,12 +31,12 @@ void OSXEventQueueBuffer::waitForEvent(double timeout) { std::unique_lock lock(m_mutex); if (m_dataQueue.empty()) { - LOG_DEBUG2("waiting for event, timeout: %f seconds", timeout); + LOG_VERBOSE("waiting for event, timeout: %f seconds", timeout); auto end = timeout < 0 ? std::chrono::steady_clock::time_point::max() : std::chrono::steady_clock::now() + std::chrono::duration(timeout); m_cond.wait_until(lock, end, [this] { return !m_dataQueue.empty(); }); } else { - LOG_DEBUG2("found events in the queue"); + LOG_VERBOSE("found events in the queue"); } } @@ -44,7 +44,7 @@ IEventQueueBuffer::Type OSXEventQueueBuffer::getEvent(Event &event, uint32_t &da { std::unique_lock lock(m_mutex); if (m_dataQueue.empty()) { - LOG_DEBUG2("no events in queue"); + LOG_VERBOSE("no events in queue"); return IEventQueueBuffer::Type::Unknown; } @@ -52,17 +52,17 @@ IEventQueueBuffer::Type OSXEventQueueBuffer::getEvent(Event &event, uint32_t &da m_dataQueue.pop(); lock.unlock(); // Unlock early to allow other threads to proceed - LOG_DEBUG2("handled user event with dataID: %u", dataID); + LOG_VERBOSE("handled user event with dataID: %u", dataID); return IEventQueueBuffer::Type::User; } bool OSXEventQueueBuffer::addEvent(uint32_t dataID) { std::scoped_lock lock{m_mutex}; - LOG_DEBUG2("adding user event with dataID: %u", dataID); + LOG_VERBOSE("adding user event with dataID: %u", dataID); m_dataQueue.push(dataID); m_cond.notify_one(); - LOG_DEBUG2("user event added to queue, dataID=%u", dataID); + LOG_VERBOSE("user event added to queue, dataID=%u", dataID); return true; } @@ -70,6 +70,6 @@ bool OSXEventQueueBuffer::isEmpty() const { std::scoped_lock lock{m_mutex}; bool empty = m_dataQueue.empty(); - LOG_DEBUG2("queue is %s", empty ? "empty" : "not empty"); + LOG_VERBOSE("queue is %s", empty ? "empty" : "not empty"); return empty; } diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp index ade788e7f..4e2d8030e 100644 --- a/src/lib/platform/OSXKeyState.cpp +++ b/src/lib/platform/OSXKeyState.cpp @@ -231,7 +231,7 @@ KeyModifierMask OSXKeyState::mapModifiersFromOSX(uint32_t mask) const outMask |= KeyModifierNumLock; } - LOG_DEBUG1("mask=%04x outMask=%04x", mask, outMask); + LOG_VERBOSE("mask=%04x outMask=%04x", mask, outMask); return outMask; } @@ -339,7 +339,7 @@ KeyButton OSXKeyState::mapKeyFromEvent(KeyIDs &ids, KeyModifierMask *maskOut, CG // translate key UniCharCount count; UniChar chars[2]; - LOG_DEBUG2("modifiers: %08x", modifiers & 0xffu); + LOG_VERBOSE("modifiers: %08x", modifiers & 0xffu); OSStatus status = UCKeyTranslate( layout, vkCode & 0xffu, action, (modifiers >> 8) & 0xffu, LMGetKbdType(), 0, &m_deadKeyState, sizeof(chars) / sizeof(chars[0]), &count, chars @@ -427,7 +427,7 @@ KeyModifierMask OSXKeyState::pollActiveModifiers() const outMask |= KeyModifierNumLock; } - LOG_DEBUG1("mask=%04x outMask=%04x", mask, outMask); + LOG_VERBOSE("mask=%04x outMask=%04x", mask, outMask); return outMask; } @@ -508,13 +508,13 @@ void OSXKeyState::getKeyMap(deskflow::KeyMap &keyMap) if (layoutValid) { OSXUchrKeyResource uchr(resource, keyboardType); if (uchr.isValid()) { - LOG_DEBUG1("using uchr resource for group %d", g); + LOG_VERBOSE("using uchr resource for group %d", g); getKeyMap(keyMap, g, uchr); continue; } } - LOG_DEBUG1("no keyboard resource for group %d", g); + LOG_VERBOSE("no keyboard resource for group %d", g); } } @@ -573,7 +573,7 @@ void OSXKeyState::setKeyboardModifiers(CGKeyCode virtualKey, bool keyDown) m_capsPressed = keyDown; break; default: - LOG_DEBUG1("the key is not a modifier"); + LOG_VERBOSE("the key is not a modifier"); break; } } @@ -622,7 +622,7 @@ void OSXKeyState::fakeKey(const Keystroke &keystroke) KeyButton button = keystroke.m_data.m_button.m_button; CGKeyCode virtualKey = mapKeyButtonToVirtualKey(button); - LOG_DEBUG1( + LOG_VERBOSE( " button=0x%04x virtualKey=0x%04x keyDown=%s client=0x%04x", button, virtualKey, keyDown ? "down" : "up", client ); @@ -640,10 +640,10 @@ void OSXKeyState::fakeKey(const Keystroke &keystroke) int32_t group = keystroke.m_data.m_group.m_group; if (!keystroke.m_data.m_group.m_restore) { if (keystroke.m_data.m_group.m_absolute) { - LOG_DEBUG1(" group %d", group); + LOG_VERBOSE(" group %d", group); setGroup(group); } else { - LOG_DEBUG1(" group %+d", group); + LOG_VERBOSE(" group %+d", group); setGroup(getEffectiveGroup(pollActiveGroup(), group)); } @@ -882,7 +882,7 @@ bool OSXKeyState::getGroups(AutoCFArray &groups) const if (CFArrayGetCount(kbds.get()) > 0) { groups = std::move(kbds); } else { - LOG_DEBUG1("can't get keyboard layouts"); + LOG_VERBOSE("can't get keyboard layouts"); return false; } @@ -915,7 +915,7 @@ void OSXKeyState::setGroup(int32_t group) } } - LOG_DEBUG1("keyboard layout change to %d", group); + LOG_VERBOSE("keyboard layout change to %d", group); // A minimal delay is needed after a group change because the // keyboard key event often happens immediately after. diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index 1a86c391a..04c5d920a 100644 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -540,7 +540,7 @@ void OSXScreen::fakeMouseButton(ButtonID id, bool press) EMouseButtonState state = press ? kMouseButtonDown : kMouseButtonUp; - LOG_DEBUG1("faking mouse button id: %d press: %s", index, press ? "pressed" : "released"); + LOG_VERBOSE("faking mouse button id: %d press: %s", index, press ? "pressed" : "released"); MouseButtonEventMapType thisButtonMap = MouseButtonEventMap[index]; CGEventType type = thisButtonMap[state]; @@ -815,7 +815,7 @@ bool OSXScreen::setClipboard(ClipboardID, const IClipboard *src) void OSXScreen::checkClipboards() { - LOG_DEBUG2("checking clipboard"); + LOG_VERBOSE("checking clipboard"); if (m_pasteboard.synchronize()) { LOG_DEBUG("clipboard changed"); sendClipboardEvent(EventTypes::ClipboardGrabbed, kClipboardClipboard); @@ -933,19 +933,19 @@ void OSXScreen::handleSystemEvent(const Event &event) SendEventToEventTarget(*carbonEvent, nullptr); switch (GetEventKind(*carbonEvent)) { case kEventWindowActivated: - LOG_DEBUG1("window activated"); + LOG_VERBOSE("window activated"); break; case kEventWindowDeactivated: - LOG_DEBUG1("window deactivated"); + LOG_VERBOSE("window deactivated"); break; case kEventWindowFocusAcquired: - LOG_DEBUG1("focus acquired"); + LOG_VERBOSE("focus acquired"); break; case kEventWindowFocusRelinquish: - LOG_DEBUG1("focus released"); + LOG_VERBOSE("focus released"); break; } break; @@ -967,7 +967,7 @@ bool OSXScreen::onMouseMove() CGFloat mx = pos.x; CGFloat my = pos.y; - LOG_DEBUG2("mouse move %+f,%+f", mx, my); + LOG_VERBOSE("mouse move %+f,%+f", mx, my); CGFloat x = mx - m_xCursor; CGFloat y = my - m_yCursor; @@ -1026,13 +1026,13 @@ bool OSXScreen::onMouseButton(bool pressed, uint16_t macButton) ButtonID button = mapMacButtonToDeskflow(macButton); if (pressed) { - LOG_DEBUG1("event: button press button=%d", button); + LOG_VERBOSE("event: button press button=%d", button); if (button != kButtonNone) { KeyModifierMask mask = m_keyState->getActiveModifiers(); sendEvent(EventTypes::PrimaryScreenButtonDown, ButtonInfo::alloc(button, mask)); } } else { - LOG_DEBUG1("event: button release button=%d", button); + LOG_VERBOSE("event: button release button=%d", button); if (button != kButtonNone) { KeyModifierMask mask = m_keyState->getActiveModifiers(); sendEvent(EventTypes::PrimaryScreenButtonUp, ButtonInfo::alloc(button, mask)); @@ -1044,7 +1044,7 @@ bool OSXScreen::onMouseButton(bool pressed, uint16_t macButton) bool OSXScreen::onMouseWheel(int32_t xDelta, int32_t yDelta) const { - LOG_DEBUG1("event: button wheel delta=%+d,%+d", xDelta, yDelta); + LOG_VERBOSE("event: button wheel delta=%+d,%+d", xDelta, yDelta); sendEvent(EventTypes::PrimaryScreenWheel, WheelInfo::alloc(xDelta, yDelta)); return true; } @@ -1062,10 +1062,10 @@ void OSXScreen::displayReconfigurationCallback( kCGDisplayDisabledFlag | kCGDisplayMirrorFlag | kCGDisplayUnMirrorFlag | kCGDisplayDesktopShapeChangedFlag; - LOG_DEBUG1("event: display was reconfigured: %x %x %x", flags, mask, flags & mask); + LOG_VERBOSE("event: display was reconfigured: %x %x %x", flags, mask, flags & mask); if (flags & mask) { /* Something actually did change */ - LOG_DEBUG1("event: screen changed shape; refreshing dimensions"); + LOG_VERBOSE("event: screen changed shape; refreshing dimensions"); if (!screen->updateScreenShape(displayID, flags)) { LOG_ERR("failed to update screen shape during display reconfiguration"); } @@ -1079,7 +1079,7 @@ bool OSXScreen::onKey(CGEventRef event) // get the key and active modifiers uint32_t virtualKey = CGEventGetIntegerValueField(event, kCGKeyboardEventKeycode); CGEventFlags macMask = CGEventGetFlags(event); - LOG_DEBUG1("event: Key event kind: %d, keycode=%d", eventKind, virtualKey); + LOG_VERBOSE("event: Key event kind: %d, keycode=%d", eventKind, virtualKey); // Special handling to track state of modifiers if (eventKind == kCGEventFlagsChanged) { @@ -1189,7 +1189,7 @@ void OSXScreen::onMediaKey(CGEventRef event) return; } - LOG_DEBUG2("Media key event: keyID=0x%02x, %s, repeat=%s", keyID, (down ? "down" : "up"), (isRepeat ? "yes" : "no")); + LOG_VERBOSE("Media key event: keyID=0x%02x, %s, repeat=%s", keyID, (down ? "down" : "up"), (isRepeat ? "yes" : "no")); KeyButton button = 0; KeyModifierMask mask = m_keyState->getActiveModifiers(); @@ -1724,16 +1724,16 @@ CGEventRef OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, CGEventType type default: if (type == NX_SYSDEFINED) { if (isMediaKeyEvent(event)) { - LOG_DEBUG2("detected media key event"); + LOG_VERBOSE("detected media key event"); screen->onMediaKey(event); } else { - LOG_DEBUG2("ignoring unknown system defined event"); + LOG_VERBOSE("ignoring unknown system defined event"); return event; } break; } - LOG_DEBUG2("unknown quartz event type: 0x%02x", type); + LOG_VERBOSE("unknown quartz event type: 0x%02x", type); } if (screen->m_isOnScreen) { diff --git a/src/lib/platform/OSXScreenSaver.cpp b/src/lib/platform/OSXScreenSaver.cpp index 43d90f065..42b3dd3f9 100644 --- a/src/lib/platform/OSXScreenSaver.cpp +++ b/src/lib/platform/OSXScreenSaver.cpp @@ -89,7 +89,7 @@ void OSXScreenSaver::processLaunched(ProcessSerialNumber psn) { if (isScreenSaverEngine(psn)) { m_screenSaverPSN = psn; - LOG_DEBUG1("screen saver engine launched, enabled=%d", m_enabled); + LOG_VERBOSE("screen saver engine launched, enabled=%d", m_enabled); if (m_enabled) { m_events->addEvent(Event(EventTypes::PrimaryScreenSaverActivated, m_eventTarget)); } @@ -99,7 +99,7 @@ void OSXScreenSaver::processLaunched(ProcessSerialNumber psn) void OSXScreenSaver::processTerminated(ProcessSerialNumber psn) { if (m_screenSaverPSN.highLongOfPSN == psn.highLongOfPSN && m_screenSaverPSN.lowLongOfPSN == psn.lowLongOfPSN) { - LOG_DEBUG1("screen saver engine terminated, enabled=%d", m_enabled); + LOG_VERBOSE("screen saver engine terminated, enabled=%d", m_enabled); if (m_enabled) { m_events->addEvent(Event(EventTypes::PrimaryScreenSaverDeactivated, m_eventTarget)); } diff --git a/src/lib/platform/WlClipboardCollection.cpp b/src/lib/platform/WlClipboardCollection.cpp index 2faedd031..e20abe2fc 100644 --- a/src/lib/platform/WlClipboardCollection.cpp +++ b/src/lib/platform/WlClipboardCollection.cpp @@ -116,7 +116,7 @@ void WlClipboardCollection::initialize() m_clipboards[kClipboardClipboard] = std::make_unique(kClipboardClipboard); m_available = true; - LOG_DEBUG1("initialized Wayland clipboard support"); + LOG_VERBOSE("initialized Wayland clipboard support"); } catch (const std::exception &e) { LOG_ERR("failed to initialize clipboard: %s", e.what()); diff --git a/src/lib/platform/XWindowsClipboard.cpp b/src/lib/platform/XWindowsClipboard.cpp index 1278e6154..567a72d86 100644 --- a/src/lib/platform/XWindowsClipboard.cpp +++ b/src/lib/platform/XWindowsClipboard.cpp @@ -95,7 +95,7 @@ void XWindowsClipboard::addRequest(Window owner, Window requestor, Atom target, // at the given time. bool success = false; if (owner == m_window) { - LOG_DEBUG1( + LOG_VERBOSE( "request for clipboard %d, target %s by 0x%08x (property=%s)", m_selection, XWindowsUtil::atomToString(m_display, target).c_str(), requestor, XWindowsUtil::atomToString(m_display, property).c_str() @@ -112,13 +112,13 @@ void XWindowsClipboard::addRequest(Window owner, Window requestor, Atom target, success = true; } } else { - LOG_DEBUG1("clipboard not owned at time %d", time); + LOG_VERBOSE("clipboard not owned at time %d", time); } } if (!success) { // send failure - LOG_DEBUG1("clipboard request was not added"); + LOG_VERBOSE("clipboard request was not added"); insertReply(new Reply(requestor, target, time)); } @@ -162,12 +162,12 @@ bool XWindowsClipboard::addSimpleRequest(Window requestor, Atom target, ::Time t if (type != None) { // success - LOG_DEBUG1("clipboard request added"); + LOG_VERBOSE("clipboard request added"); insertReply(new Reply(requestor, target, time, property, data, type, format)); return true; } else { // failure - LOG_DEBUG1("clipboard request not added"); + LOG_VERBOSE("clipboard request not added"); insertReply(new Reply(requestor, target, time)); return false; } @@ -180,7 +180,7 @@ bool XWindowsClipboard::processRequest(Window requestor, ::Time /*time*/, Atom p // unknown requestor window return false; } - LOG_DEBUG1( + LOG_VERBOSE( "received property %s delete from 0x08%x", XWindowsUtil::atomToString(m_display, property).c_str(), requestor ); @@ -295,7 +295,7 @@ bool XWindowsClipboard::open(Time time) const // check if motif owns the selection. unlock motif clipboard // if it does not. m_motif = motifOwnsClipboard(); - LOG_DEBUG1("motif does %sown clipboard", m_motif ? "" : "not "); + LOG_VERBOSE("motif does %sown clipboard", m_motif ? "" : "not "); if (!m_motif) { motifUnlockClipboard(); } @@ -366,13 +366,13 @@ IXWindowsClipboardConverter *XWindowsClipboard::getConverter(Atom target, bool o } } if (converter == nullptr) { - LOG_DEBUG1(" no converter for target %s", XWindowsUtil::atomToString(m_display, target).c_str()); + LOG_VERBOSE(" no converter for target %s", XWindowsUtil::atomToString(m_display, target).c_str()); return nullptr; } // optionally skip already handled targets if (const auto formatID = static_cast(converter->getFormat()); onlyIfNotAdded && m_added[formatID]) { - LOG_DEBUG1(" skipping handled format %d", formatID); + LOG_VERBOSE(" skipping handled format %d", formatID); return nullptr; } @@ -453,7 +453,7 @@ void XWindowsClipboard::icccmFillCache() Atom target; std::string data; if (!icccmGetSelection(atomTargets, &target, &data) || (target != m_atomAtom && target != m_atomTargets)) { - LOG_DEBUG1("selection doesn't support TARGETS"); + LOG_VERBOSE("selection doesn't support TARGETS"); data = ""; XWindowsUtil::appendAtomData(data, XA_STRING); } @@ -496,7 +496,7 @@ void XWindowsClipboard::icccmFillCache() Atom actualTarget; std::string targetData; if (!icccmGetSelection(target, &actualTarget, &targetData)) { - LOG_DEBUG1(" no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()); + LOG_VERBOSE(" no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()); continue; } @@ -519,11 +519,11 @@ bool XWindowsClipboard::icccmGetSelection(Atom target, Atom *actualTarget, std:: // request data conversion if (CICCCMGetClipboard getter(m_window, m_time, m_atomData); !getter.readClipboard(m_display, m_selection, target, actualTarget, data)) { - LOG_DEBUG1("can't get data for selection target %s", XWindowsUtil::atomToString(m_display, target).c_str()); + LOG_VERBOSE("can't get data for selection target %s", XWindowsUtil::atomToString(m_display, target).c_str()); LOGC(getter.error(), (CLOG_WARN "icccm violation by clipboard owner")); return false; } else if (*actualTarget == None) { - LOG_DEBUG1("selection conversion failed for target %s", XWindowsUtil::atomToString(m_display, target).c_str()); + LOG_VERBOSE("selection conversion failed for target %s", XWindowsUtil::atomToString(m_display, target).c_str()); return false; } return true; @@ -535,11 +535,11 @@ IClipboard::Time XWindowsClipboard::icccmGetTime() const std::string data; if (icccmGetSelection(m_atomTimestamp, &actualTarget, &data) && actualTarget == m_atomInteger) { Time time = *static_cast(static_cast(data.data())); - LOG_DEBUG1("got ICCCM time %d", time); + LOG_VERBOSE("got ICCCM time %d", time); return time; } else { // no timestamp - LOG_DEBUG1("can't get ICCCM time"); + LOG_VERBOSE("can't get ICCCM time"); return 0; } } @@ -549,7 +549,7 @@ bool XWindowsClipboard::motifLockClipboard() const // fail if anybody owns the lock (even us, so this is non-recursive) Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock); if (lockOwner != None) { - LOG_DEBUG1("motif lock owner 0x%08x", lockOwner); + LOG_VERBOSE("motif lock owner 0x%08x", lockOwner); return false; } @@ -561,17 +561,17 @@ bool XWindowsClipboard::motifLockClipboard() const XSetSelectionOwner(m_display, m_atomMotifClipLock, m_window, time); lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock); if (lockOwner != m_window) { - LOG_DEBUG1("motif lock owner 0x%08x", lockOwner); + LOG_VERBOSE("motif lock owner 0x%08x", lockOwner); return false; } - LOG_DEBUG1("locked motif clipboard"); + LOG_VERBOSE("locked motif clipboard"); return true; } void XWindowsClipboard::motifUnlockClipboard() const { - LOG_DEBUG1("unlocked motif clipboard"); + LOG_VERBOSE("unlocked motif clipboard"); // fail if we don't own the lock if (Window lockOwner = XGetSelectionOwner(m_display, m_atomMotifClipLock); lockOwner != m_window) { @@ -721,7 +721,7 @@ void XWindowsClipboard::motifFillCache() Atom actualTarget; std::string targetData; if (!motifGetSelection(&motifFormat, &actualTarget, &targetData)) { - LOG_DEBUG1(" no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()); + LOG_VERBOSE(" no data for target %s", XWindowsUtil::atomToString(m_display, target).c_str()); continue; } @@ -907,7 +907,7 @@ bool XWindowsClipboard::sendReply(Reply *reply) // bail out immediately if reply is done if (reply->m_done) { LOG(( - CLOG_DEBUG1 "clipboard: finished reply to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property + CLOG_VERBOSE "clipboard: finished reply to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property )); return true; } @@ -916,7 +916,7 @@ bool XWindowsClipboard::sendReply(Reply *reply) bool failed = (reply->m_property == None); if (!failed) { LOG( - (CLOG_DEBUG1 "clipboard: setting property on 0x%08x,%d,%d", reply->m_requestor, reply->m_target, + (CLOG_VERBOSE "clipboard: setting property on 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property) ); @@ -965,9 +965,10 @@ bool XWindowsClipboard::sendReply(Reply *reply) // the final zero-length property. // FIXME -- how do you gracefully cancel an incremental transfer? if (failed) { - LOG(( - CLOG_DEBUG1 "clipboard: sending failure to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property - )); + LOG( + (CLOG_VERBOSE "clipboard: sending failure to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, + reply->m_property) + ); reply->m_done = true; if (reply->m_property != None) { XWindowsUtil::ErrorLock lock(m_display); @@ -995,11 +996,11 @@ bool XWindowsClipboard::sendReply(Reply *reply) return false; } - LOG_DEBUG1("clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property); + LOG_VERBOSE("clipboard: sending notify to 0x%08x,%d,%d", reply->m_requestor, reply->m_target, reply->m_property); reply->m_replied = true; // nothing to log - if (CLOG->getFilter() < LogLevel::Debug2) { + if (CLOG->getFilter() < LogLevel::Verbose) { sendNotify( reply->m_requestor, m_selection, reply->m_target, reply->m_property, static_cast(reply->m_time) ); @@ -1008,20 +1009,20 @@ bool XWindowsClipboard::sendReply(Reply *reply) return false; } - // dump every property on the requestor window to the debug2 + // dump every property on the requestor window to the Trace // log. we've seen what appears to be a bug in lesstif and // knowing the properties may help design a workaround, if // it becomes necessary. XWindowsUtil::ErrorLock lock(m_display); int n; Atom *props = XListProperties(m_display, reply->m_requestor, &n); - LOG_DEBUG2("properties of 0x%08x:", reply->m_requestor); + LOG_VERBOSE("properties of 0x%08x:", reply->m_requestor); for (int i = 0; i < n; ++i) { Atom target; std::string data; char *name = XGetAtomName(m_display, props[i]); if (!XWindowsUtil::getWindowProperty(m_display, reply->m_requestor, props[i], &data, &target, nullptr, False)) { - LOG_DEBUG2(" %s: ", name); + LOG_VERBOSE(" %s: ", name); } else { // convert to hex if contains non ascii symbols if (std::ranges::find_if(data, [](const unsigned char &c) { return c < 32 || c > 126; }) != data.end()) { @@ -1036,7 +1037,7 @@ bool XWindowsClipboard::sendReply(Reply *reply) data = tmp; } char *type = XGetAtomName(m_display, target); - LOG_DEBUG2(" %s (%s): %s", name, type, data.c_str()); + LOG_VERBOSE(" %s (%s): %s", name, type, data.c_str()); if (type != nullptr) { XFree(type); } @@ -1168,10 +1169,10 @@ bool XWindowsClipboard::CICCCMGetClipboard::readClipboard( assert(actualTarget != nullptr); assert(data != nullptr); - LOG( - (CLOG_DEBUG1 "request selection=%s, target=%s, window=%x", XWindowsUtil::atomToString(display, selection).c_str(), - XWindowsUtil::atomToString(display, target).c_str(), m_requestor) - ); + LOG(( + CLOG_VERBOSE "request selection=%s, target=%s, window=%x", XWindowsUtil::atomToString(display, selection).c_str(), + XWindowsUtil::atomToString(display, target).c_str(), m_requestor + )); m_atomNone = XInternAtom(display, "NONE", False); m_atomIncr = XInternAtom(display, "INCR", False); @@ -1253,7 +1254,7 @@ bool XWindowsClipboard::CICCCMGetClipboard::readClipboard( XSelectInput(display, m_requestor, attr.your_event_mask); // return success or failure - LOG_DEBUG1("request %s after %fs", m_failed ? "failed" : "succeeded", timeout.getTime()); + LOG_VERBOSE("request %s after %fs", m_failed ? "failed" : "succeeded", timeout.getTime()); return !m_failed; } @@ -1335,7 +1336,7 @@ bool XWindowsClipboard::CICCCMGetClipboard::processEvent(Display *display, const else if (m_incr) { // if first incremental chunk then save target if (oldSize == 0) { - LOG_DEBUG1(" INCR first chunk, target %s", XWindowsUtil::atomToString(display, target).c_str()); + LOG_VERBOSE(" INCR first chunk, target %s", XWindowsUtil::atomToString(display, target).c_str()); *m_actualTarget = target; } @@ -1350,20 +1351,20 @@ bool XWindowsClipboard::CICCCMGetClipboard::processEvent(Display *display, const // note if this is the final chunk if (m_data->size() == oldSize) { - LOG_DEBUG1(" INCR final chunk: %d bytes total", m_data->size()); + LOG_VERBOSE(" INCR final chunk: %d bytes total", m_data->size()); m_done = true; } } // not incremental; save the target. else { - LOG_DEBUG1(" target %s", XWindowsUtil::atomToString(display, target).c_str()); + LOG_VERBOSE(" target %s", XWindowsUtil::atomToString(display, target).c_str()); *m_actualTarget = target; m_done = true; } // this event has been processed - LOGC(!m_incr, (CLOG_DEBUG1 " got data, %d bytes", m_data->size())); + LOGC(!m_incr, (CLOG_VERBOSE " got data, %d bytes", m_data->size())); return true; } diff --git a/src/lib/platform/XWindowsKeyState.cpp b/src/lib/platform/XWindowsKeyState.cpp index 9d7d778b2..7343d4e20 100644 --- a/src/lib/platform/XWindowsKeyState.cpp +++ b/src/lib/platform/XWindowsKeyState.cpp @@ -99,12 +99,12 @@ void XWindowsKeyState::setAutoRepeat(const XKeyboardState &state) KeyModifierMask XWindowsKeyState::mapModifiersFromX(unsigned int state) const { - LOG_DEBUG2("mapping state: %i", state); + LOG_VERBOSE("mapping state: %i", state); uint32_t offset = 8 * getGroupFromState(state); KeyModifierMask mask = 0; for (int i = 0; i < 8; ++i) { if ((state & (1u << i)) != 0) { - LOG_DEBUG2("|= modifier: %i", offset + i); + LOG_VERBOSE("|= modifier: %i", offset + i); if (offset + i >= m_modifierFromX.size()) { LOG( (CLOG_ERR "m_modifierFromX is too small (%d) for the " @@ -272,7 +272,7 @@ void XWindowsKeyState::fakeKey(const Keystroke &keystroke) int b = 1 << (c & 7); if (m_keyboardState.global_auto_repeat == AutoRepeatModeOff || (c != 113 && c != 116 && (m_keyboardState.auto_repeats[i] & b) == 0)) { - LOG_DEBUG1(" discard autorepeat"); + LOG_VERBOSE(" discard autorepeat"); break; } } @@ -296,12 +296,12 @@ void XWindowsKeyState::fakeKey(const Keystroke &keystroke) #if HAVE_XKB_EXTENSION if (m_xkb != nullptr) { if (XkbLockGroup(m_display, XkbUseCoreKbd, keystroke.m_data.m_group.m_group) == False) { - LOG_DEBUG1("xkb lock group request not sent"); + LOG_VERBOSE("xkb lock group request not sent"); } } else #endif { - LOG_DEBUG1(" ignored"); + LOG_VERBOSE(" ignored"); } } else { @@ -315,12 +315,12 @@ void XWindowsKeyState::fakeKey(const Keystroke &keystroke) if (XkbLockGroup( m_display, XkbUseCoreKbd, getEffectiveGroup(pollActiveGroup(), keystroke.m_data.m_group.m_group) ) == False) { - LOG_DEBUG1("xkb lock group request not sent"); + LOG_VERBOSE("xkb lock group request not sent"); } } else #endif { - LOG_DEBUG1(" ignored"); + LOG_VERBOSE(" ignored"); } } @@ -334,7 +334,7 @@ void XWindowsKeyState::updateKeysymMap(deskflow::KeyMap &keyMap) // there are up to 4 keysyms per keycode static const int maxKeysyms = 4; - LOG_DEBUG1("non-XKB mapping"); + LOG_VERBOSE("non-XKB mapping"); // prepare map from X modifier to KeyModifierMask. certain bits // are predefined. @@ -569,7 +569,7 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap) } }; - LOG_DEBUG1("xkb mapping"); + LOG_VERBOSE("xkb mapping"); // find the number of groups int maxNumGroups = 0; diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index 25af166d4..71d87bf7b 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -403,10 +403,10 @@ void XWindowsScreen::setOptions(const OptionsList &options) for (uint32_t i = 0, n = options.size(); i < n; i += 2) { if (options[i] == kOptionXTestXineramaUnaware) { m_xtestIsXineramaUnaware = (options[i + 1] != 0); - LOG_DEBUG1("library, XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false"); + LOG_VERBOSE("library, XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false"); } else if (options[i] == kOptionScreenPreserveFocus) { m_preserveFocus = (options[i + 1] != 0); - LOG_DEBUG1("preserve focus: %s", m_preserveFocus ? "true" : "false"); + LOG_VERBOSE("preserve focus: %s", m_preserveFocus ? "true" : "false"); } } } @@ -834,7 +834,7 @@ Display *XWindowsScreen::openDisplay(const char *displayName) } // open the display - LOG_DEBUG2("calling XOpenDisplay(\"%s\")", displayName); + LOG_VERBOSE("calling XOpenDisplay(\"%s\")", displayName); Display *display = XOpenDisplay(displayName); if (display == nullptr) { throw ScreenUnavailableException(); @@ -1343,7 +1343,7 @@ void XWindowsScreen::handleSystemEvent(const Event &event) void XWindowsScreen::onKeyPress(XKeyEvent &xkey) { - LOG_DEBUG1("event: KeyPress code=%d, state=0x%04x", xkey.keycode, xkey.state); + LOG_VERBOSE("event: KeyPress code=%d, state=0x%04x", xkey.keycode, xkey.state); const KeyModifierMask mask = m_keyState->mapModifiersFromX(xkey.state); KeyID key = mapKeyFromX(&xkey); if (key != kKeyNone) { @@ -1364,7 +1364,7 @@ void XWindowsScreen::onKeyPress(XKeyEvent &xkey) keycode = static_cast(m_lastKeycode); if (keycode == 0) { // no keycode - LOG_DEBUG1("event: KeyPress no keycode"); + LOG_VERBOSE("event: KeyPress no keycode"); return; } } @@ -1377,7 +1377,7 @@ void XWindowsScreen::onKeyPress(XKeyEvent &xkey) m_keyState->sendKeyEvent(getEventTarget(), false, false, key, mask, 1, keycode); } } else { - LOG_DEBUG1("can't map keycode to key id"); + LOG_VERBOSE("can't map keycode to key id"); } } @@ -1398,14 +1398,14 @@ void XWindowsScreen::onKeyRelease(XKeyEvent &xkey, bool isRepeat) auto keycode = static_cast(xkey.keycode); if (!isRepeat) { // no press event follows so it's a plain release - LOG_DEBUG1("event: KeyRelease code=%d, state=0x%04x", keycode, xkey.state); + LOG_VERBOSE("event: KeyRelease code=%d, state=0x%04x", keycode, xkey.state); m_keyState->sendKeyEvent(getEventTarget(), false, false, key, mask, 1, keycode); } else { // found a press event following so it's a repeat. // we could attempt to count the already queued // repeats but we'll just send a repeat of 1. // note that we discard the press event. - LOG_DEBUG1("event: repeat code=%d, state=0x%04x", keycode, xkey.state); + LOG_VERBOSE("event: repeat code=%d, state=0x%04x", keycode, xkey.state); m_keyState->sendKeyEvent(getEventTarget(), false, true, key, mask, 1, keycode); } } @@ -1438,7 +1438,7 @@ bool XWindowsScreen::onHotKey(const XKeyEvent &xkey, bool isRepeat) void XWindowsScreen::onMousePress(const XButtonEvent &xbutton) { - LOG_DEBUG1("event: ButtonPress button=%d", xbutton.button); + LOG_VERBOSE("event: ButtonPress button=%d", xbutton.button); ButtonID button = mapButtonFromX(&xbutton); KeyModifierMask mask = m_keyState->mapModifiersFromX(xbutton.state); if (button != kButtonNone) { @@ -1449,7 +1449,7 @@ void XWindowsScreen::onMousePress(const XButtonEvent &xbutton) void XWindowsScreen::onMouseRelease(const XButtonEvent &xbutton) { using enum EventTypes; - LOG_DEBUG1("event: ButtonRelease button=%d", xbutton.button); + LOG_VERBOSE("event: ButtonRelease button=%d", xbutton.button); ButtonID button = mapButtonFromX(&xbutton); KeyModifierMask mask = m_keyState->mapModifiersFromX(xbutton.state); if (button != kButtonNone) { @@ -1471,7 +1471,7 @@ void XWindowsScreen::onMouseRelease(const XButtonEvent &xbutton) void XWindowsScreen::onMouseMove(const XMotionEvent &xmotion) { - LOG_DEBUG2("event: MotionNotify %d,%d", xmotion.x_root, xmotion.y_root); + LOG_VERBOSE("event: MotionNotify %d,%d", xmotion.x_root, xmotion.y_root); // compute motion delta (relative to the last known // mouse position) @@ -1726,11 +1726,11 @@ KeyID XWindowsScreen::mapKeyFromX(XKeyEvent *event) const XLookupString(event, dummy, 0, &keysym, nullptr); } - LOG_DEBUG2("mapped code=%d to keysym=0x%04x", event->keycode, keysym); + LOG_VERBOSE("mapped code=%d to keysym=0x%04x", event->keycode, keysym); // convert key KeyID result = XDGKeyUtil::mapKeySymToKeyID(keysym); - LOG_DEBUG2("mapped keysym=0x%04x to keyID=%d", keysym, result); + LOG_VERBOSE("mapped keysym=0x%04x to keyID=%d", keysym, result); return result; } @@ -1805,7 +1805,7 @@ void XWindowsScreen::warpCursorNoFlush(int32_t x, int32_t y) XSendEvent(m_display, m_window, False, 0, &eventAfter); XSync(m_display, False); - LOG_DEBUG2("warped to %d,%d", x, y); + LOG_VERBOSE("warped to %d,%d", x, y); } void XWindowsScreen::updateButtons() @@ -1857,15 +1857,15 @@ bool XWindowsScreen::grabMouseAndKeyboard() result = XGrabKeyboard(m_display, m_window, True, GrabModeAsync, GrabModeAsync, CurrentTime); assert(result != GrabNotViewable); if (result != GrabSuccess) { - LOG_DEBUG2("waiting to grab keyboard"); + LOG_VERBOSE("waiting to grab keyboard"); Arch::sleep(0.05); if (timer.getTime() >= s_timeout) { - LOG_DEBUG2("grab keyboard timed out"); + LOG_VERBOSE("grab keyboard timed out"); return false; } } } while (result != GrabSuccess); - LOG_DEBUG2("grabbed keyboard"); + LOG_VERBOSE("grabbed keyboard"); // now the mouse --- use event_mask to get EnterNotify, LeaveNotify events result = @@ -1874,16 +1874,16 @@ bool XWindowsScreen::grabMouseAndKeyboard() if (result != GrabSuccess) { // back off to avoid grab deadlock XUngrabKeyboard(m_display, CurrentTime); - LOG_DEBUG2("ungrabbed keyboard, waiting to grab pointer"); + LOG_VERBOSE("ungrabbed keyboard, waiting to grab pointer"); Arch::sleep(0.05); if (timer.getTime() >= s_timeout) { - LOG_DEBUG2("grab pointer timed out"); + LOG_VERBOSE("grab pointer timed out"); return false; } } } while (result != GrabSuccess); - LOG_DEBUG1("grabbed pointer and keyboard"); + LOG_VERBOSE("grabbed pointer and keyboard"); return true; } diff --git a/src/lib/platform/XWindowsUtil.cpp b/src/lib/platform/XWindowsUtil.cpp index 1f5efad66..50520b543 100644 --- a/src/lib/platform/XWindowsUtil.cpp +++ b/src/lib/platform/XWindowsUtil.cpp @@ -94,12 +94,12 @@ bool XWindowsUtil::getWindowProperty( if (okay) { LOG( - (CLOG_DEBUG2 "read property %d on window 0x%08x: bytes=%d", property, window, + (CLOG_VERBOSE "read property %d on window 0x%08x: bytes=%d", property, window, (data == nullptr) ? 0 : data->size()) ); return true; } else { - LOG_DEBUG2("can't read property %d on window 0x%08x", property, window); + LOG_VERBOSE("can't read property %d on window 0x%08x", property, window); return false; } } @@ -317,13 +317,13 @@ int XWindowsUtil::ErrorLock::internalHandler(Display *display, XErrorEvent *even void XWindowsUtil::ErrorLock::ignoreHandler(Display *, XErrorEvent *e, void *) { - LOG_DEBUG1("ignoring X error: %d", e->error_code); + LOG_VERBOSE("ignoring X error: %d", e->error_code); } void XWindowsUtil::ErrorLock::saveHandler(Display *display, XErrorEvent *e, void *flag) { char errtxt[1024]; XGetErrorText(display, e->error_code, errtxt, 1023); - LOG_DEBUG1("flagging X error: %d - %.1023s", e->error_code, errtxt); + LOG_VERBOSE("flagging X error: %d - %.1023s", e->error_code, errtxt); *static_cast(flag) = true; } diff --git a/src/lib/server/ClientListener.cpp b/src/lib/server/ClientListener.cpp index 80d54b42b..74af0ee30 100644 --- a/src/lib/server/ClientListener.cpp +++ b/src/lib/server/ClientListener.cpp @@ -46,7 +46,7 @@ ClientListener::ClientListener( m_socketFactory.reset(); throw; } - LOG_DEBUG1("listening for clients"); + LOG_VERBOSE("listening for clients"); } ClientListener::~ClientListener() @@ -82,14 +82,14 @@ void ClientListener::start() }); // bind listen address - LOG_DEBUG1("binding listen socket"); + LOG_VERBOSE("binding listen socket"); m_listen->bind(m_address); } void ClientListener::stop() { using enum EventTypes; - LOG_DEBUG1("stop listening for clients"); + LOG_VERBOSE("stop listening for clients"); // discard already connected clients for (auto index = m_newClients.begin(); index != m_newClients.end(); ++index) { diff --git a/src/lib/server/ClientProxy.cpp b/src/lib/server/ClientProxy.cpp index b79e232bd..0f233e82a 100644 --- a/src/lib/server/ClientProxy.cpp +++ b/src/lib/server/ClientProxy.cpp @@ -27,7 +27,7 @@ ClientProxy::~ClientProxy() void ClientProxy::close(const char *msg) const { - LOG_DEBUG1("send close \"%s\" to \"%s\"", msg, getName().c_str()); + LOG_VERBOSE("send close \"%s\" to \"%s\"", msg, getName().c_str()); ProtocolUtil::writef(getStream(), msg); // force the close to be sent before we return diff --git a/src/lib/server/ClientProxy1_0.cpp b/src/lib/server/ClientProxy1_0.cpp index 3becfaa56..546f08e6a 100644 --- a/src/lib/server/ClientProxy1_0.cpp +++ b/src/lib/server/ClientProxy1_0.cpp @@ -42,7 +42,7 @@ ClientProxy1_0::ClientProxy1_0(const std::string &name, deskflow::IStream *strea setHeartbeatRate(kHeartRate, kHeartRate * kHeartBeatsUntilDeath); - LOG_DEBUG1("querying client \"%s\" info", getName().c_str()); + LOG_VERBOSE("querying client \"%s\" info", getName().c_str()); ProtocolUtil::writef(getStream(), kMsgQInfo); } @@ -120,7 +120,7 @@ void ClientProxy1_0::handleData() // parse message try { - LOG_DEBUG2("msg from \"%s\": %c%c%c%c", getName().c_str(), code[0], code[1], code[2], code[3]); + LOG_VERBOSE("msg from \"%s\": %c%c%c%c", getName().c_str(), code[0], code[1], code[2], code[3]); if (!(this->*m_parser)(code)) { LOG( (CLOG_ERR "invalid message from client \"%s\": %c%c%c%c", getName().c_str(), code[0], code[1], code[2], @@ -149,7 +149,7 @@ bool ClientProxy1_0::parseHandshakeMessage(const uint8_t *code) { if (memcmp(code, kMsgCNoop, 4) == 0) { // discard no-ops - LOG_DEBUG2("no-op from", getName().c_str()); + LOG_VERBOSE("no-op from", getName().c_str()); return true; } else if (memcmp(code, kMsgDInfo, 4) == 0) { // future messages get parsed by parseMessage @@ -173,7 +173,7 @@ bool ClientProxy1_0::parseMessage(const uint8_t *code) return false; } else if (memcmp(code, kMsgCNoop, 4) == 0) { // discard no-ops - LOG_DEBUG2("no-op from", getName().c_str()); + LOG_VERBOSE("no-op from", getName().c_str()); return true; } else if (memcmp(code, kMsgCClipboard, 4) == 0) { return recvGrabClipboard(); @@ -225,13 +225,13 @@ void ClientProxy1_0::getCursorPos(int32_t &x, int32_t &y) const void ClientProxy1_0::enter(int32_t xAbs, int32_t yAbs, uint32_t seqNum, KeyModifierMask mask, bool) { - LOG_DEBUG1("send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask); + LOG_VERBOSE("send enter to \"%s\", %d,%d %d %04x", getName().c_str(), xAbs, yAbs, seqNum, mask); ProtocolUtil::writef(getStream(), kMsgCEnter, xAbs, yAbs, seqNum, mask); } bool ClientProxy1_0::leave() { - LOG_DEBUG1("send leave to \"%s\"", getName().c_str()); + LOG_VERBOSE("send leave to \"%s\"", getName().c_str()); ProtocolUtil::writef(getStream(), kMsgCLeave); // we can never prevent the user from leaving @@ -259,37 +259,37 @@ void ClientProxy1_0::setClipboardDirty(ClipboardID id, bool dirty) void ClientProxy1_0::keyDown(KeyID key, KeyModifierMask mask, KeyButton, const std::string &) { - LOG_DEBUG1("send key down to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask); + LOG_VERBOSE("send key down to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask); ProtocolUtil::writef(getStream(), kMsgDKeyDown1_0, key, mask); } void ClientProxy1_0::keyRepeat(KeyID key, KeyModifierMask mask, int32_t count, KeyButton, const std::string &) { - LOG_DEBUG1("send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getName().c_str(), key, mask, count); + LOG_VERBOSE("send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d", getName().c_str(), key, mask, count); ProtocolUtil::writef(getStream(), kMsgDKeyRepeat1_0, key, mask, count); } void ClientProxy1_0::keyUp(KeyID key, KeyModifierMask mask, KeyButton) { - LOG_DEBUG1("send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask); + LOG_VERBOSE("send key up to \"%s\" id=%d, mask=0x%04x", getName().c_str(), key, mask); ProtocolUtil::writef(getStream(), kMsgDKeyUp1_0, key, mask); } void ClientProxy1_0::mouseDown(ButtonID button) { - LOG_DEBUG1("send mouse down to \"%s\" id=%d", getName().c_str(), button); + LOG_VERBOSE("send mouse down to \"%s\" id=%d", getName().c_str(), button); ProtocolUtil::writef(getStream(), kMsgDMouseDown, button); } void ClientProxy1_0::mouseUp(ButtonID button) { - LOG_DEBUG1("send mouse up to \"%s\" id=%d", getName().c_str(), button); + LOG_VERBOSE("send mouse up to \"%s\" id=%d", getName().c_str(), button); ProtocolUtil::writef(getStream(), kMsgDMouseUp, button); } void ClientProxy1_0::mouseMove(int32_t xAbs, int32_t yAbs) { - LOG_DEBUG2("send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs); + LOG_VERBOSE("send mouse move to \"%s\" %d,%d", getName().c_str(), xAbs, yAbs); ProtocolUtil::writef(getStream(), kMsgDMouseMove, xAbs, yAbs); } @@ -301,7 +301,7 @@ void ClientProxy1_0::mouseRelativeMove(int32_t, int32_t) void ClientProxy1_0::mouseWheel(int32_t, int32_t yDelta) { // clients prior to 1.3 only support the y axis - LOG_DEBUG2("send mouse wheel to \"%s\" %+d", getName().c_str(), yDelta); + LOG_VERBOSE("send mouse wheel to \"%s\" %+d", getName().c_str(), yDelta); ProtocolUtil::writef(getStream(), kMsgDMouseWheel1_0, yDelta); } @@ -332,13 +332,13 @@ void ClientProxy1_0::secureInputNotification(const std::string &) const void ClientProxy1_0::screensaver(bool on) { - LOG_DEBUG1("send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0); + LOG_VERBOSE("send screen saver to \"%s\" on=%d", getName().c_str(), on ? 1 : 0); ProtocolUtil::writef(getStream(), kMsgCScreenSaver, on ? 1 : 0); } void ClientProxy1_0::resetOptions() { - LOG_DEBUG1("send reset options to \"%s\"", getName().c_str()); + LOG_VERBOSE("send reset options to \"%s\"", getName().c_str()); ProtocolUtil::writef(getStream(), kMsgCResetOptions); // reset heart rate and death @@ -349,7 +349,7 @@ void ClientProxy1_0::resetOptions() void ClientProxy1_0::setOptions(const OptionsList &options) { - LOG_DEBUG1("send set options to \"%s\" size=%d", getName().c_str(), options.size()); + LOG_VERBOSE("send set options to \"%s\" size=%d", getName().c_str(), options.size()); ProtocolUtil::writef(getStream(), kMsgDSetOptions, &options); // check options @@ -399,7 +399,7 @@ bool ClientProxy1_0::recvInfo() m_info.m_my = my; // acknowledge receipt - LOG_DEBUG1("send info ack to \"%s\"", getName().c_str()); + LOG_VERBOSE("send info ack to \"%s\"", getName().c_str()); ProtocolUtil::writef(getStream(), kMsgCInfoAck); return true; } diff --git a/src/lib/server/ClientProxy1_1.cpp b/src/lib/server/ClientProxy1_1.cpp index 63d6933d9..9c27388e8 100644 --- a/src/lib/server/ClientProxy1_1.cpp +++ b/src/lib/server/ClientProxy1_1.cpp @@ -22,7 +22,7 @@ ClientProxy1_1::ClientProxy1_1(const std::string &name, deskflow::IStream *strea void ClientProxy1_1::keyDown(KeyID key, KeyModifierMask mask, KeyButton button, const std::string &) { - LOG_DEBUG1("send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button); + LOG_VERBOSE("send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button); ProtocolUtil::writef(getStream(), kMsgDKeyDown, key, mask, button); } @@ -31,8 +31,8 @@ void ClientProxy1_1::keyRepeat( ) { LOG( - (CLOG_DEBUG1 "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d, " - "button=0x%04x, lang=\"%s\"", + (CLOG_VERBOSE "send key repeat to \"%s\" id=%d, mask=0x%04x, count=%d, " + "button=0x%04x, lang=\"%s\"", getName().c_str(), key, mask, count, button, lang.c_str()) ); ProtocolUtil::writef(getStream(), kMsgDKeyRepeat, key, mask, count, button, &lang); @@ -40,6 +40,6 @@ void ClientProxy1_1::keyRepeat( void ClientProxy1_1::keyUp(KeyID key, KeyModifierMask mask, KeyButton button) { - LOG_DEBUG1("send key up to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button); + LOG_VERBOSE("send key up to \"%s\" id=%d, mask=0x%04x, button=0x%04x", getName().c_str(), key, mask, button); ProtocolUtil::writef(getStream(), kMsgDKeyUp, key, mask, button); } diff --git a/src/lib/server/ClientProxy1_2.cpp b/src/lib/server/ClientProxy1_2.cpp index d02745acb..a1ef8add8 100644 --- a/src/lib/server/ClientProxy1_2.cpp +++ b/src/lib/server/ClientProxy1_2.cpp @@ -22,6 +22,6 @@ ClientProxy1_2::ClientProxy1_2(const std::string &name, deskflow::IStream *strea void ClientProxy1_2::mouseRelativeMove(int32_t xRel, int32_t yRel) { - LOG_DEBUG2("send mouse relative move to \"%s\" %d,%d", getName().c_str(), xRel, yRel); + LOG_VERBOSE("send mouse relative move to \"%s\" %d,%d", getName().c_str(), xRel, yRel); ProtocolUtil::writef(getStream(), kMsgDMouseRelMove, xRel, yRel); } diff --git a/src/lib/server/ClientProxy1_3.cpp b/src/lib/server/ClientProxy1_3.cpp index e1ee0476f..871960155 100644 --- a/src/lib/server/ClientProxy1_3.cpp +++ b/src/lib/server/ClientProxy1_3.cpp @@ -33,7 +33,7 @@ ClientProxy1_3::~ClientProxy1_3() void ClientProxy1_3::mouseWheel(int32_t xDelta, int32_t yDelta) { - LOG_DEBUG2("send mouse wheel to \"%s\" %+d,%+d", getName().c_str(), xDelta, yDelta); + LOG_VERBOSE("send mouse wheel to \"%s\" %+d,%+d", getName().c_str(), xDelta, yDelta); ProtocolUtil::writef(getStream(), kMsgDMouseWheel, xDelta, yDelta); } diff --git a/src/lib/server/ClientProxy1_7.cpp b/src/lib/server/ClientProxy1_7.cpp index 33fcd25a6..0f17f8f38 100644 --- a/src/lib/server/ClientProxy1_7.cpp +++ b/src/lib/server/ClientProxy1_7.cpp @@ -21,6 +21,6 @@ ClientProxy1_7::ClientProxy1_7(const std::string &name, deskflow::IStream *strea void ClientProxy1_7::secureInputNotification(const std::string &app) const { - LOG_DEBUG2("send secure input notification to \"%s\" %s", getName().c_str(), app.c_str()); + LOG_VERBOSE("send secure input notification to \"%s\" %s", getName().c_str(), app.c_str()); ProtocolUtil::writef(getStream(), kMsgDSecureInputNotification, &app); } diff --git a/src/lib/server/ClientProxy1_8.cpp b/src/lib/server/ClientProxy1_8.cpp index fcdb63352..1ea0d5f33 100644 --- a/src/lib/server/ClientProxy1_8.cpp +++ b/src/lib/server/ClientProxy1_8.cpp @@ -23,7 +23,7 @@ void ClientProxy1_8::synchronizeLanguages() const deskflow::KeyboardLayoutManager layoutManager; auto localLayouts = layoutManager.getSerializedLocalLayouts(); if (!localLayouts.empty()) { - LOG_DEBUG1("send server languages to the client: %s", localLayouts.c_str()); + LOG_VERBOSE("send server languages to the client: %s", localLayouts.c_str()); ProtocolUtil::writef(getStream(), kMsgDLanguageSynchronisation, &localLayouts); } else { LOG_ERR("failed to read server languages"); @@ -33,8 +33,8 @@ void ClientProxy1_8::synchronizeLanguages() const void ClientProxy1_8::keyDown(KeyID key, KeyModifierMask mask, KeyButton button, const std::string &language) { LOG( - (CLOG_DEBUG1 "send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x, layout=%s", getName().c_str(), key, mask, - button, language.c_str()) + (CLOG_VERBOSE "send key down to \"%s\" id=%d, mask=0x%04x, button=0x%04x, layout=%s", getName().c_str(), key, + mask, button, language.c_str()) ); ProtocolUtil::writef(getStream(), kMsgDKeyDownLang, key, mask, button, &language); } diff --git a/src/lib/server/ClientProxyUnknown.cpp b/src/lib/server/ClientProxyUnknown.cpp index ca6dc5dfe..0c048db24 100644 --- a/src/lib/server/ClientProxyUnknown.cpp +++ b/src/lib/server/ClientProxyUnknown.cpp @@ -190,14 +190,14 @@ void ClientProxyUnknown::initProxy(const std::string &name, int major, int minor void ClientProxyUnknown::handleData() { - LOG_DEBUG1("parsing hello reply"); + LOG_VERBOSE("parsing hello reply"); std::string name(""); try { // limit the maximum length of the hello if (uint32_t n = m_stream->getSize(); n > kMaxHelloLength) { - LOG_DEBUG1("hello reply too long"); + LOG_VERBOSE("hello reply too long"); throw BadClientException(); } @@ -222,7 +222,7 @@ void ClientProxyUnknown::handleData() initProxy(name, major, minor); // the proxy is created and now proxy now owns the stream - LOG_DEBUG1("created proxy for client \"%s\" version %d.%d", name.c_str(), major, minor); + LOG_VERBOSE("created proxy for client \"%s\" version %d.%d", name.c_str(), major, minor); m_stream = nullptr; // wait until the proxy signals that it's ready or has disconnected diff --git a/src/lib/server/InputFilter.cpp b/src/lib/server/InputFilter.cpp index b9227dec0..0f96c7255 100644 --- a/src/lib/server/InputFilter.cpp +++ b/src/lib/server/InputFilter.cpp @@ -677,18 +677,18 @@ bool InputFilter::Rule::handleEvent(const Event &event) case Activate: actions = &m_activateActions; - LOG_DEBUG1("activate actions"); + LOG_VERBOSE("activate actions"); break; case Deactivate: actions = &m_deactivateActions; - LOG_DEBUG1("deactivate actions"); + LOG_VERBOSE("deactivate actions"); break; } // perform actions for (auto action : *actions) { - LOG_DEBUG1("hotkey: %s", action->format().c_str()); + LOG_VERBOSE("hotkey: %s", action->format().c_str()); action->perform(event); } diff --git a/src/lib/server/Server.cpp b/src/lib/server/Server.cpp index 49972c9d0..b957d63de 100644 --- a/src/lib/server/Server.cpp +++ b/src/lib/server/Server.cpp @@ -571,7 +571,7 @@ BaseClientProxy *Server::getNeighbor(const BaseClientProxy *src, Direction dir, // get source screen name std::string srcName = getName(src); assert(!srcName.empty()); - LOG_DEBUG2("find neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str()); + LOG_VERBOSE("find neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str()); // convert position to fraction float t = mapToFraction(src, dir, x, y); @@ -586,20 +586,20 @@ BaseClientProxy *Server::getNeighbor(const BaseClientProxy *src, Direction dir, // progress in this direction. since we haven't found a // connected neighbor we return nullptr. if (dstName.empty()) { - LOG_DEBUG2("no neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str()); + LOG_VERBOSE("no neighbor on %s of \"%s\"", Config::dirName(dir), srcName.c_str()); return nullptr; } // look up neighbor cell. if the screen is connected and // ready then we can stop. if (ClientList::const_iterator index = m_clients.find(dstName); index != m_clients.end()) { - LOG_DEBUG2("\"%s\" is on %s of \"%s\" at %f", dstName.c_str(), Config::dirName(dir), srcName.c_str(), t); + LOG_VERBOSE("\"%s\" is on %s of \"%s\" at %f", dstName.c_str(), Config::dirName(dir), srcName.c_str(), t); mapToPixel(index->second, dir, tTmp, x, y); return index->second; } // skip over unconnected screen - LOG_DEBUG2("ignored \"%s\" on %s of \"%s\"", dstName.c_str(), Config::dirName(dir), srcName.c_str()); + LOG_VERBOSE("ignored \"%s\" on %s of \"%s\"", dstName.c_str(), Config::dirName(dir), srcName.c_str()); srcName = dstName; // use position on skipped screen @@ -643,7 +643,7 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, Direction srcSide, if (x >= 0) { break; } - LOG_DEBUG2("skipping over screen %s", getName(dst).c_str()); + LOG_VERBOSE("skipping over screen %s", getName(dst).c_str()); dst = getNeighbor(lastGoodScreen, srcSide, x, y); } assert(lastGoodScreen != nullptr); @@ -659,7 +659,7 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, Direction srcSide, if (x < dw) { break; } - LOG_DEBUG2("skipping over screen %s", getName(dst).c_str()); + LOG_VERBOSE("skipping over screen %s", getName(dst).c_str()); dst = getNeighbor(lastGoodScreen, srcSide, x, y); } assert(lastGoodScreen != nullptr); @@ -675,7 +675,7 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, Direction srcSide, if (y >= 0) { break; } - LOG_DEBUG2("skipping over screen %s", getName(dst).c_str()); + LOG_VERBOSE("skipping over screen %s", getName(dst).c_str()); dst = getNeighbor(lastGoodScreen, srcSide, x, y); } assert(lastGoodScreen != nullptr); @@ -691,7 +691,7 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, Direction srcSide, if (y < dh) { break; } - LOG_DEBUG2("skipping over screen %s", getName(dst).c_str()); + LOG_VERBOSE("skipping over screen %s", getName(dst).c_str()); dst = getNeighbor(lastGoodScreen, srcSide, x, y); } assert(lastGoodScreen != nullptr); @@ -766,13 +766,13 @@ bool Server::isSwitchOkay( BaseClientProxy *newScreen, Direction dir, int32_t x, int32_t y, int32_t xActive, int32_t yActive ) { - LOG_DEBUG1("try to leave \"%s\" on %s", getName(m_active).c_str(), Config::dirName(dir)); + LOG_VERBOSE("try to leave \"%s\" on %s", getName(m_active).c_str(), Config::dirName(dir)); // is there a neighbor? if (newScreen == nullptr) { // there's no neighbor. we don't want to switch and we don't // want to try to switch later. - LOG_DEBUG1("no neighbor %s", Config::dirName(dir)); + LOG_VERBOSE("no neighbor %s", Config::dirName(dir)); stopSwitch(); return false; } @@ -829,7 +829,7 @@ bool Server::isSwitchOkay( // see if we're in a locked corner if ((getCorner(m_active, xActive, yActive, size) & corners) != 0) { // yep, no switching - LOG_DEBUG1("locked in corner"); + LOG_VERBOSE("locked in corner"); preventSwitch = true; stopSwitch(); } @@ -837,7 +837,7 @@ bool Server::isSwitchOkay( // ignore if mouse is locked to screen and don't try to switch later if (!preventSwitch && isLockedToScreen()) { - LOG_DEBUG1("locked to screen"); + LOG_VERBOSE("locked to screen"); preventSwitch = true; stopSwitch(); } @@ -847,7 +847,7 @@ bool Server::isSwitchOkay( !preventSwitch && ((this->m_switchNeedsShift && ((mods & KeyModifierShift) != KeyModifierShift)) || (this->m_switchNeedsControl && ((mods & KeyModifierControl) != KeyModifierControl)) || (this->m_switchNeedsAlt && ((mods & KeyModifierAlt) != KeyModifierAlt)))) { - LOG_DEBUG1("need modifiers to switch"); + LOG_VERBOSE("need modifiers to switch"); preventSwitch = true; stopSwitch(); } @@ -876,7 +876,7 @@ void Server::startSwitchTwoTap() m_switchTwoTapEngaged = true; m_switchTwoTapArmed = false; m_switchTwoTapTimer.reset(); - LOG_DEBUG1("waiting for second tap"); + LOG_VERBOSE("waiting for second tap"); } void Server::armSwitchTwoTap(int32_t x, int32_t y) @@ -951,7 +951,7 @@ void Server::startSwitchWait(int32_t x, int32_t y) m_switchWaitX = x; m_switchWaitY = y; m_switchWaitTimer = m_events->newOneShotTimer(m_switchWaitDelay, this); - LOG_DEBUG1("waiting to switch"); + LOG_VERBOSE("waiting to switch"); } void Server::stopSwitchWait() @@ -1034,7 +1034,7 @@ void Server::stopRelativeMoves() m_yDelta = 0; m_xDelta2 = 0; m_yDelta2 = 0; - LOG_DEBUG2("synchronize move on %s by %d,%d", getName(m_active).c_str(), m_x, m_y); + LOG_VERBOSE("synchronize move on %s by %d,%d", getName(m_active).c_str(), m_x, m_y); m_active->mouseMove(m_x, m_y); } } @@ -1281,7 +1281,7 @@ void Server::handleSwitchWaitTimeout() { // ignore if mouse is locked to screen if (isLockedToScreen()) { - LOG_DEBUG1("locked to screen"); + LOG_VERBOSE("locked to screen"); stopSwitch(); return; } @@ -1320,7 +1320,7 @@ void Server::handleSwitchToScreenEvent(const Event &event) ClientList::const_iterator index = m_clients.find(info->m_screen); if (index == m_clients.end()) { - LOG_DEBUG1("screen \"%s\" not active", info->m_screen.c_str()); + LOG_VERBOSE("screen \"%s\" not active", info->m_screen.c_str()); } else { jumpToScreen(index->second); } @@ -1335,7 +1335,7 @@ void Server::handleSwitchInDirectionEvent(const Event &event) int32_t y = m_y; BaseClientProxy *newScreen = getNeighbor(m_active, info->m_direction, x, y); if (newScreen == nullptr) { - LOG_DEBUG1("no neighbor %s", Config::dirName(info->m_direction)); + LOG_VERBOSE("no neighbor %s", Config::dirName(info->m_direction)); } else { jumpToScreen(newScreen); } @@ -1541,7 +1541,7 @@ void Server::onScreensaver(bool activated) void Server::onKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const std::string &lang, const char *screens) { - LOG_DEBUG1("onKeyDown id=%d mask=0x%04x button=0x%04x lang=%s", id, mask, button, lang.c_str()); + LOG_VERBOSE("onKeyDown id=%d mask=0x%04x button=0x%04x lang=%s", id, mask, button, lang.c_str()); assert(m_active != nullptr); // relay @@ -1564,7 +1564,7 @@ void Server::onKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const s void Server::onKeyUp(KeyID id, KeyModifierMask mask, KeyButton button, const char *screens) { - LOG_DEBUG1("onKeyUp id=%d mask=0x%04x button=0x%04x", id, mask, button); + LOG_VERBOSE("onKeyUp id=%d mask=0x%04x button=0x%04x", id, mask, button); assert(m_active != nullptr); // relay @@ -1588,7 +1588,7 @@ void Server::onKeyUp(KeyID id, KeyModifierMask mask, KeyButton button, const cha void Server::onKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButton button, const std::string &lang) { LOG( - (CLOG_DEBUG1 "onKeyRepeat id=%d mask=0x%04x count=%d button=0x%04x lang=\"%s\"", id, mask, count, button, + (CLOG_VERBOSE "onKeyRepeat id=%d mask=0x%04x count=%d button=0x%04x lang=\"%s\"", id, mask, count, button, lang.c_str()) ); assert(m_active != nullptr); @@ -1599,7 +1599,7 @@ void Server::onKeyRepeat(KeyID id, KeyModifierMask mask, int32_t count, KeyButto void Server::onMouseDown(ButtonID id) { - LOG_DEBUG1("onMouseDown id=%d", id); + LOG_VERBOSE("onMouseDown id=%d", id); assert(m_active != nullptr); // relay @@ -1608,7 +1608,7 @@ void Server::onMouseDown(ButtonID id) void Server::onMouseUp(ButtonID id) { - LOG_DEBUG1("onMouseUp id=%d", id); + LOG_VERBOSE("onMouseUp id=%d", id); assert(m_active != nullptr); // relay @@ -1617,7 +1617,7 @@ void Server::onMouseUp(ButtonID id) bool Server::onMouseMovePrimary(int32_t x, int32_t y) { - LOG_DEBUG2("onMouseMovePrimary %d,%d", x, y); + LOG_VERBOSE("onMouseMovePrimary %d,%d", x, y); // mouse move on primary (server's) screen if (m_active != m_primaryClient) { @@ -1714,7 +1714,7 @@ bool Server::onMouseMovePrimary(int32_t x, int32_t y) void Server::onMouseMoveSecondary(int32_t dx, int32_t dy) { - LOG_DEBUG2("mouse move on secondary: %+d,%+d", dx, dy); + LOG_VERBOSE("mouse move on secondary: %+d,%+d", dx, dy); // TODO: move this to client side and use a qt setting or cli arg instead of env var. const static auto adjustEnv = "DESKFLOW_MOUSE_ADJUSTMENT"; @@ -1723,7 +1723,7 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy) double multiplier = std::stod(envVal); dx = static_cast(std::round(dx * multiplier)); dy = static_cast(std::round(dy * multiplier)); - LOG_DEBUG2("adjusted mouse x %.2f: %+d,%+d", multiplier, dx, dy); + LOG_VERBOSE("adjusted mouse x %.2f: %+d,%+d", multiplier, dx, dy); } catch (const std::exception &e) { LOG_ERR("invalid %s value: %s", adjustEnv, e.what()); } @@ -1743,7 +1743,7 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy) // program on the secondary screen to warp the mouse on us, so we // have no idea where it really is. if (m_relativeMoves && isLockedToScreenServer()) { - LOG_DEBUG2("relative move on %s by %d,%d", getName(m_active).c_str(), dx, dy); + LOG_VERBOSE("relative move on %s by %d,%d", getName(m_active).c_str(), dx, dy); m_active->mouseRelativeMove(dx, dy); return; } @@ -1863,22 +1863,22 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy) m_y = yOld + dy; if (m_x < ax) { m_x = ax; - LOG_DEBUG2("clamp to left of \"%s\"", getName(m_active).c_str()); + LOG_VERBOSE("clamp to left of \"%s\"", getName(m_active).c_str()); } else if (m_x > ax + aw - 1) { m_x = ax + aw - 1; - LOG_DEBUG2("clamp to right of \"%s\"", getName(m_active).c_str()); + LOG_VERBOSE("clamp to right of \"%s\"", getName(m_active).c_str()); } if (m_y < ay) { m_y = ay; - LOG_DEBUG2("clamp to top of \"%s\"", getName(m_active).c_str()); + LOG_VERBOSE("clamp to top of \"%s\"", getName(m_active).c_str()); } else if (m_y > ay + ah - 1) { m_y = ay + ah - 1; - LOG_DEBUG2("clamp to bottom of \"%s\"", getName(m_active).c_str()); + LOG_VERBOSE("clamp to bottom of \"%s\"", getName(m_active).c_str()); } // warp cursor if it moved. if (m_x != xOld || m_y != yOld) { - LOG_DEBUG2("move on %s to %d,%d", getName(m_active).c_str(), m_x, m_y); + LOG_VERBOSE("move on %s to %d,%d", getName(m_active).c_str(), m_x, m_y); m_active->mouseMove(m_x, m_y); } } @@ -1886,7 +1886,7 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy) void Server::onMouseWheel(int32_t xDelta, int32_t yDelta) { - LOG_DEBUG1("onMouseWheel %+d,%+d", xDelta, yDelta); + LOG_VERBOSE("onMouseWheel %+d,%+d", xDelta, yDelta); assert(m_active != nullptr); // relay diff --git a/src/unittests/base/LogTests.cpp b/src/unittests/base/LogTests.cpp index 095382673..3096f99ea 100644 --- a/src/unittests/base/LogTests.cpp +++ b/src/unittests/base/LogTests.cpp @@ -25,7 +25,7 @@ QString sanitizeBuffer(const std::stringstream &in) void LogTests::initTestCase() { std::setlocale(LC_NUMERIC, "C"); - m_log.setFilter(LogLevel::Debug1); + m_log.setFilter(LogLevel::Debug); } void LogTests::printWithErrorValidOutput() @@ -86,7 +86,7 @@ void LogTests::printLevelToHigh() std::stringstream buffer; std::streambuf *old = std::cout.rdbuf(buffer.rdbuf()); - m_log.print(CLOG_DEBUG2 "test message"); + m_log.print(CLOG_VERBOSE "test message"); auto string = sanitizeBuffer(buffer); std::cout.rdbuf(old); diff --git a/src/unittests/base/UnicodeTests.cpp b/src/unittests/base/UnicodeTests.cpp index b3854075d..18d984fe0 100644 --- a/src/unittests/base/UnicodeTests.cpp +++ b/src/unittests/base/UnicodeTests.cpp @@ -11,7 +11,7 @@ void UnicodeTests::initTestCase() { - m_log.setFilter(LogLevel::Debug2); + m_log.setFilter(LogLevel::Verbose); } void UnicodeTests::UTF16ToUTF8() diff --git a/src/unittests/common/SettingsTests.cpp b/src/unittests/common/SettingsTests.cpp index dce606ad7..9ecb351eb 100644 --- a/src/unittests/common/SettingsTests.cpp +++ b/src/unittests/common/SettingsTests.cpp @@ -108,8 +108,7 @@ void SettingsTests::checkLogLevels_Valid() QCOMPARE(Settings::logLevelToInt(QStringLiteral("wArning")), 2); QCOMPARE(Settings::logLevelToInt(QStringLiteral("info")), 3); QCOMPARE(Settings::logLevelToInt(QStringLiteral("deBug")), 4); - QCOMPARE(Settings::logLevelToInt(QStringLiteral("debuG1")), 5); - QCOMPARE(Settings::logLevelToInt(QStringLiteral("dEbug2")), 6); + QCOMPARE(Settings::logLevelToInt(QStringLiteral("TraCe")), 5); } void SettingsTests::checkLogLevels_Invalid() diff --git a/src/unittests/deskflow/ClipboardTests.cpp b/src/unittests/deskflow/ClipboardTests.cpp index 33287376e..c25db3b1e 100644 --- a/src/unittests/deskflow/ClipboardTests.cpp +++ b/src/unittests/deskflow/ClipboardTests.cpp @@ -12,7 +12,7 @@ void ClipboardTests::initTestCase() { - m_log.setFilter(LogLevel::Debug2); + m_log.setFilter(LogLevel::Verbose); } void ClipboardTests::basicFunction() diff --git a/src/unittests/deskflow/KeyboardLayoutManagerTests.cpp b/src/unittests/deskflow/KeyboardLayoutManagerTests.cpp index 0d602a8d0..063439e0a 100644 --- a/src/unittests/deskflow/KeyboardLayoutManagerTests.cpp +++ b/src/unittests/deskflow/KeyboardLayoutManagerTests.cpp @@ -11,7 +11,7 @@ void KeyboardLayoutManagerTests::initTestCase() { - m_log.setFilter(LogLevel::Debug2); + m_log.setFilter(LogLevel::Verbose); } void KeyboardLayoutManagerTests::remoteLayouts() diff --git a/src/unittests/legacytests/legacytests/main.cpp b/src/unittests/legacytests/legacytests/main.cpp index cd311b26a..0b91ef3d7 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::Debug2); + log.setFilter(LogLevel::Verbose); ::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 3c9ddd882..55f032636 100644 --- a/src/unittests/platform/MSWindowsClipboardTests.cpp +++ b/src/unittests/platform/MSWindowsClipboardTests.cpp @@ -12,7 +12,7 @@ void MSWindowsClipboardTests::initTestCase() { - m_log.setFilter(LogLevel::Debug2); + m_log.setFilter(LogLevel::Verbose); MSWindowsClipboard clipboard(NULL); diff --git a/src/unittests/platform/OSXKeyStateTests.cpp b/src/unittests/platform/OSXKeyStateTests.cpp index f8aa0b1d5..58012d35d 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(LogLevel::Debug2); + m_log.setFilter(LogLevel::Verbose); } void OSXKeyStateTests::mapModifiersFromOSX_OSXMask() diff --git a/src/unittests/platform/WlClipboardTests.cpp b/src/unittests/platform/WlClipboardTests.cpp index 889d63302..176945b9f 100644 --- a/src/unittests/platform/WlClipboardTests.cpp +++ b/src/unittests/platform/WlClipboardTests.cpp @@ -40,7 +40,7 @@ void WlClipboardTests::isAvailable() void WlClipboardTests::initTestCase() { m_arch.init(); - m_log.setFilter(LogLevel::Debug2); + m_log.setFilter(LogLevel::Verbose); // Only run tests if Wayland clipboard tools are available if (!deskflow::platform::isWayland()) { diff --git a/translations/deskflow_es.ts b/translations/deskflow_es.ts index 118f3eaec..aa15fe70e 100644 --- a/translations/deskflow_es.ts +++ b/translations/deskflow_es.ts @@ -1169,22 +1169,10 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU Debug Depurar - - Debug1 - Depuración1 - - - Debug2 - Depuración 2 - Level Nivel - - Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report. - Usar un nivel de registro de depuración puede afectar el rendimiento. Úselo solo si intenta depurar un problema o recopila registros para enviarlos junto con un informe de errores. - Use background service (daemon) Utilizar un servicio en segundo plano (daemon) @@ -1213,10 +1201,6 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU Debug entries Entradas de depuración - - More debug output - Más resultados de depuración - Verbose debug output Salida de depuración detallada @@ -1325,6 +1309,14 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU Run command on exit Ejecutar comando al salir + + Trace + Rastro + + + Using a log level higher than Info may affect performance. + Utilizar un nivel de registro superior a Info puede afectar el rendimiento. + StatusBar diff --git a/translations/deskflow_it.ts b/translations/deskflow_it.ts index 65dce6d37..1d43b0289 100644 --- a/translations/deskflow_it.ts +++ b/translations/deskflow_it.ts @@ -1169,22 +1169,10 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf Debug Debug - - Debug1 - Debug1 - - - Debug2 - Debug2 - Level Livello - - Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report. - L'utilizzo di un livello di log Debug può influire sulle prestazioni. Utilizza un livello Debug solo se stai tentando di eseguire il debug di un problema o stai raccogliendo log da inviare con una segnalazione di bug. - Use background service (daemon) Utilizza il servizio in background (daemon) @@ -1213,10 +1201,6 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf Debug entries Voci di debug - - More debug output - Più output di debug - Verbose debug output Output di debug dettagliato @@ -1325,6 +1309,14 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf Run command on exit Esegui comando all'uscita + + Trace + Traccia + + + Using a log level higher than Info may affect performance. + L'utilizzo di un livello di log superiore a Info potrebbe influire sulle prestazioni. + StatusBar diff --git a/translations/deskflow_ja.ts b/translations/deskflow_ja.ts index b490d19f0..64c8882d9 100644 --- a/translations/deskflow_ja.ts +++ b/translations/deskflow_ja.ts @@ -1171,22 +1171,10 @@ Enabling this setting will disable the server config GUI. Debug デバッグ - - Debug1 - デバッグ1 - - - Debug2 - デバッグ2 - Log path ログファイルのパス - - Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report. - デバッグレベルのログ取得は性能に影響が出ることがあります。不具合の修正やバグレポートの送信に必要な場合にのみ使用してください。 - Enable GUI debug messages GUIのデバッグメッセージを有効にする @@ -1239,10 +1227,6 @@ Enabling this setting will disable the server config GUI. Debug entries デバッグ情報 - - More debug output - より多くのデバッグ出力 - Verbose debug output 詳細なデバッグ出力 @@ -1327,6 +1311,14 @@ Enabling this setting will disable the server config GUI. Run command on exit 終了時にコマンドを実行 + + Trace + トレース + + + Using a log level higher than Info may affect performance. + Infoよりも高いログレベルを使用すると、パフォーマンスに影響を及ぼす可能性があります。 + StatusBar diff --git a/translations/deskflow_ko.ts b/translations/deskflow_ko.ts index abce50724..66f43931d 100644 --- a/translations/deskflow_ko.ts +++ b/translations/deskflow_ko.ts @@ -1169,22 +1169,10 @@ Enabling this setting will disable the server config GUI. Debug 디버그 - - Debug1 - 디버그1 - - - Debug2 - 디버그2 - Log path 로그 경로 - - Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report. - 디버그 로그 레벨은 성능에 영향을 줄 수 있습니다. 문제를 디버깅하거나 버그 신고에 첨부할 로그를 수집할 때만 디버그 레벨을 사용하세요. - Enable GUI debug messages GUI 디버그 메시지 사용 @@ -1237,10 +1225,6 @@ Enabling this setting will disable the server config GUI. Debug entries 디버그 항목 - - More debug output - 더 많은 디버그 출력 - Verbose debug output 상세 디버그 출력 @@ -1325,6 +1309,14 @@ Enabling this setting will disable the server config GUI. Run command on exit 종료 시 명령 실행 + + Trace + 추적하다 + + + Using a log level higher than Info may affect performance. + Info보다 높은 로그 레벨을 사용하면 성능에 영향을 미칠 수 있습니다. + StatusBar diff --git a/translations/deskflow_ru.ts b/translations/deskflow_ru.ts index 93cf2d871..0d41be131 100644 --- a/translations/deskflow_ru.ts +++ b/translations/deskflow_ru.ts @@ -1167,22 +1167,10 @@ Enabling this setting will disable the server config GUI. Debug Отладка - - Debug1 - Отладка 1 - - - Debug2 - Отладка 2 - Log path Путь к журналам - - Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report. - Уровень отладки может повлиять на производительность. Используйте его только для поиска неисправностей. - Enable GUI debug messages Включить отладочные сообщения интерфейса @@ -1239,10 +1227,6 @@ Enabling this setting will disable the server config GUI. Debug entries Записи отладки - - More debug output - Расширенный вывод отладки - Verbose debug output Подробный вывод отладки @@ -1323,6 +1307,14 @@ Enabling this setting will disable the server config GUI. Run command on exit Выполнить команду при выходе + + Trace + След + + + Using a log level higher than Info may affect performance. + Использование уровня логирования выше Info может повлиять на производительность. + StatusBar diff --git a/translations/deskflow_zh_CN.ts b/translations/deskflow_zh_CN.ts index 0cde14f12..b047c5b93 100644 --- a/translations/deskflow_zh_CN.ts +++ b/translations/deskflow_zh_CN.ts @@ -1171,22 +1171,10 @@ Enabling this setting will disable the server config GUI. Debug 调试 - - Debug1 - 调试1 - - - Debug2 - 调试2 - Log path 日志路径 - - Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report. - 使用调试日志级别可能会影响性能。仅当您尝试调试问题或收集日志以提交 Bug 报告时,才使用调试级别。 - Enable GUI debug messages 启用 GUI 调试消息 @@ -1239,10 +1227,6 @@ Enabling this setting will disable the server config GUI. Debug entries 调试条目 - - More debug output - 更多调试输出 - Verbose debug output 详细调试输出 @@ -1327,6 +1311,14 @@ Enabling this setting will disable the server config GUI. Run command on exit 退出时运行命令 + + Trace + 痕迹 + + + Using a log level higher than Info may affect performance. + 使用高于 Info 级别的日志级别可能会影响性能。 + StatusBar