Made log lines consistent (#7270)

* Made log lines consistent

* Change log level for process list

* Only show advanced proc info at DEBUG2

* Fixed some more log lines

* Update AppUtilWindows.cpp
This commit is contained in:
Nick Bolton 2023-07-28 01:45:27 -07:00 committed by GitHub
parent 2fce545c17
commit 947efd5e58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 101 additions and 99 deletions

View file

@ -430,7 +430,7 @@ Client::sendClipboard(ClipboardID id)
// marshall the data // marshall the data
String data = clipboard.marshall(); String data = clipboard.marshall();
if (data.size() >= m_maximumClipboardSize * 1024) { if (data.size() >= m_maximumClipboardSize * 1024) {
LOG((CLOG_NOTE "Skipping clipboard transfer because the clipboard" LOG((CLOG_NOTE "skipping clipboard transfer because the clipboard"
" contents exceeds the %i MB size limit set by the server", " contents exceeds the %i MB size limit set by the server",
m_maximumClipboardSize / 1024)); m_maximumClipboardSize / 1024));
return; return;
@ -764,7 +764,7 @@ Client::handleHello(const Event&, void*)
if (isCompatible(major, minor)) { if (isCompatible(major, minor)) {
//because 1.6 is comptable with 1.7 and 1.8 - downgrading protocol for server //because 1.6 is comptable with 1.7 and 1.8 - downgrading protocol for server
LOG((CLOG_NOTE "Downgrading protocol version for server")); LOG((CLOG_NOTE "downgrading protocol version for server"));
helloBackMinor = minor; helloBackMinor = minor;
} }
else if (major < kProtocolMajorVersion || else if (major < kProtocolMajorVersion ||

View file

@ -976,7 +976,7 @@ ServerProxy::setActiveServerLanguage(const String& language)
if (!m_languageManager.isLanguageInstalled(m_serverLanguage)) { if (!m_languageManager.isLanguageInstalled(m_serverLanguage)) {
if(!m_isUserNotifiedAboutLanguageSyncError) { if(!m_isUserNotifiedAboutLanguageSyncError) {
LOG((CLOG_WARN "Current server language is not installed on client.")); LOG((CLOG_WARN "current server language is not installed on client"));
m_isUserNotifiedAboutLanguageSyncError = true; m_isUserNotifiedAboutLanguageSyncError = true;
} }
} }
@ -985,7 +985,7 @@ ServerProxy::setActiveServerLanguage(const String& language)
} }
} }
else { else {
LOG((CLOG_DEBUG1 "Active server langauge is empty!")); LOG((CLOG_DEBUG1 "active server langauge is empty"));
} }
} }

View file

@ -183,7 +183,7 @@ bool SslApi::isTrustedFingerprint(const std::string& fingerprint) const
} }
} }
else { else {
LOG((CLOG_ERR "Fail to open trusted fingerprints file: %s", trustedServersFilename.c_str())); LOG((CLOG_ERR "failed to open trusted fingerprints file: %s", trustedServersFilename.c_str()));
} }
return (isValid && showCertificate()); return (isValid && showCertificate());

View file

@ -692,7 +692,7 @@ SecureSocket::verifyCertFingerprint()
} }
} }
else { else {
LOG((CLOG_ERR "Fail to open trusted fingerprints file: %s", trustedServersFilename.c_str())); LOG((CLOG_ERR "fail to open trusted fingerprints file: %s", trustedServersFilename.c_str()));
} }
file.close(); file.close();

View file

@ -51,7 +51,7 @@ TCPSocket::TCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer,
throw XSocketCreate(e.what()); throw XSocketCreate(e.what());
} }
LOG((CLOG_DEBUG "Opening new socket: %08X", m_socket)); LOG((CLOG_DEBUG "opening new socket: %08X", m_socket));
init(); init();
} }
@ -66,7 +66,7 @@ TCPSocket::TCPSocket(IEventQueue* events, SocketMultiplexer* socketMultiplexer,
{ {
assert(m_socket != nullptr); assert(m_socket != nullptr);
LOG((CLOG_DEBUG "Opening new socket: %08X", m_socket)); LOG((CLOG_DEBUG "opening new socket: %08X", m_socket));
// socket starts in connected state // socket starts in connected state
init(); init();
@ -102,7 +102,7 @@ TCPSocket::bind(const NetworkAddress& addr)
void void
TCPSocket::close() TCPSocket::close()
{ {
LOG((CLOG_DEBUG "Closing socket: %08X", m_socket)); LOG((CLOG_DEBUG "closing socket: %08X", m_socket));
// remove ourself from the multiplexer // remove ourself from the multiplexer
setJob(nullptr); setJob(nullptr);

View file

@ -893,7 +893,8 @@ MSWindowsKeyState::pollPressedKeys(KeyButtonSet& pressedKeys) const
{ {
BYTE keyState[256]; BYTE keyState[256];
if (!GetKeyboardState(keyState)) { if (!GetKeyboardState(keyState)) {
LOG((CLOG_ERR "GetKeyboardState returned false on pollPressedKeys")); LOG((CLOG_WARN "keyboard state is unexpected"));
LOG((CLOG_DEBUG "function 'GetKeyboardState' returned false on 'pollPressedKeys'"));
return; return;
} }
for (KeyButton i = 1; i < 256; ++i) { for (KeyButton i = 1; i < 256; ++i) {
@ -1318,7 +1319,7 @@ MSWindowsKeyState::setWindowGroup(SInt32 group)
if(!PostMessage(targetWindow, WM_INPUTLANGCHANGEREQUEST, if(!PostMessage(targetWindow, WM_INPUTLANGCHANGEREQUEST,
sysCharSet ? 1 : 0, (LPARAM)m_groups[group])) { sysCharSet ? 1 : 0, (LPARAM)m_groups[group])) {
LOG((CLOG_WARN "Failed to post change language message!")); LOG((CLOG_WARN "failed to post change language message"));
} }
// XXX -- use a short delay to let the target window process the message // XXX -- use a short delay to let the target window process the message

View file

@ -328,7 +328,7 @@ MSWindowsScreen::leave()
POINT pos; POINT pos;
if (!getThisCursorPos(&pos)) if (!getThisCursorPos(&pos))
{ {
LOG((CLOG_DEBUG "Unable to leave screen as Windows security has disabled critical functions required to let synergy work")); LOG((CLOG_DEBUG "unable to leave screen as windows security has disabled critical functions"));
//unable to get position this means synergy will break if the cursor leaves the screen //unable to get position this means synergy will break if the cursor leaves the screen
return false; return false;
} }
@ -579,16 +579,15 @@ bool MSWindowsScreen::setThisCursorPos(int x, int y)
void MSWindowsScreen::updateDesktopThread() void MSWindowsScreen::updateDesktopThread()
{ {
LOG((CLOG_DEBUG3 "failed to set cursor while attempting to switch desktop"));
LOG((CLOG_DEBUG3 "Failed to set cursor Attempting to switch desktop"));
SetLastError(0); SetLastError(0);
HDESK cur_hdesk = OpenInputDesktop(0, true, GENERIC_ALL); HDESK cur_hdesk = OpenInputDesktop(0, true, GENERIC_ALL);
auto error = GetLastError(); auto error = GetLastError();
LOG((CLOG_DEBUG3 "\tGetting desktop Handle: %p Status code: %d", cur_hdesk, error)); LOG((CLOG_DEBUG3 "current desktop, handle=%p code=%d", cur_hdesk, error));
error = GetLastError(); error = GetLastError();
LOG((CLOG_DEBUG3 "\tSetting desktop return: %d Status code: %d", SetThreadDesktop(cur_hdesk), GetLastError())); LOG((CLOG_DEBUG3 "setting desktop, return=%d code=%d", SetThreadDesktop(cur_hdesk), GetLastError()));
CloseDesktop(cur_hdesk); CloseDesktop(cur_hdesk);
@ -1594,7 +1593,7 @@ MSWindowsScreen::warpCursorNoFlush(SInt32 x, SInt32 y)
// since this feature is mainly for client, so only check on client. // since this feature is mainly for client, so only check on client.
if (!isPrimary()) { if (!isPrimary()) {
if ((cursorPos.x != x) && (cursorPos.y != y)) { if ((cursorPos.x != x) && (cursorPos.y != y)) {
LOG((CLOG_DEBUG "SetCursorPos did not work; using fakeMouseMove instead")); LOG((CLOG_DEBUG "function 'SetCursorPos' failed; trying 'fakeMouseMove'"));
LOG((CLOG_DEBUG "cursor pos %d, %d expected pos %d, %d", cursorPos.x, cursorPos.y, x, y)); LOG((CLOG_DEBUG "cursor pos %d, %d expected pos %d, %d", cursorPos.x, cursorPos.y, x, y));
// when at Vista/7 login screen, SetCursorPos does not work (which could be // when at Vista/7 login screen, SetCursorPos does not work (which could be
// an MS security feature). instead we can use fakeMouseMove, which calls // an MS security feature). instead we can use fakeMouseMove, which calls

View file

@ -100,7 +100,7 @@ MSWindowsSession::isProcessInSession(const char* name, PHANDLE process = NULL)
nameListJoin.append(", "); nameListJoin.append(", ");
} }
LOG((CLOG_DEBUG "processes in session %d: %s", LOG((CLOG_DEBUG2 "processes in session %d: %s",
m_activeSessionId, nameListJoin.c_str())); m_activeSessionId, nameListJoin.c_str()));
CloseHandle(snapshot); CloseHandle(snapshot);

View file

@ -352,7 +352,7 @@ MSWindowsWatchdog::startProcess()
getActiveDesktop(&sa); getActiveDesktop(&sa);
if (!isDesktopRunnable(m_activeDesktop)) { if (!isDesktopRunnable(m_activeDesktop)) {
LOG((CLOG_INFO, "Starting on the login screen is disabled!")); LOG((CLOG_INFO, "starting on the login screen is disabled"));
return; return;
} }
@ -387,7 +387,8 @@ MSWindowsWatchdog::startProcess()
m_processRunning = true; m_processRunning = true;
m_processFailures = 0; m_processFailures = 0;
LOG((CLOG_DEBUG "started process, session=%i, elevated: %s, command=%s", LOG((CLOG_DEBUG "started core process from daemon"));
LOG((CLOG_DEBUG2 "process info, session=%i, elevated: %s, command=%s",
m_session.getActiveSessionId(), m_session.getActiveSessionId(),
m_elevateProcess ? "yes" : "no", m_elevateProcess ? "yes" : "no",
m_command.c_str())); m_command.c_str()));

View file

@ -218,7 +218,7 @@ OSXClipboard::get(EFormat format) const
// if no converter then we don't recognize any formats // if no converter then we don't recognize any formats
if (converter == NULL) { if (converter == NULL) {
LOG((CLOG_DEBUG "Unable to find converter for data")); LOG((CLOG_DEBUG "unable to find converter for data"));
return result; return result;
} }

View file

@ -94,7 +94,7 @@ OSXClipboardBMPConverter::getOSXFormat() const
String String
OSXClipboardBMPConverter::fromIClipboard(const String& bmp) const OSXClipboardBMPConverter::fromIClipboard(const String& bmp) const
{ {
LOG((CLOG_DEBUG1 "ENTER OSXClipboardBMPConverter::doFromIClipboard()")); LOG((CLOG_DEBUG1 "getting data from clipboard"));
// create BMP image // create BMP image
UInt8 header[14]; UInt8 header[14];
UInt8* dst = header; UInt8* dst = header;

View file

@ -161,13 +161,13 @@ getEventDriver()
sEventDrvrRef = getService(iter); sEventDrvrRef = getService(iter);
} }
else { else {
LOG((CLOG_WARN, "IOService not found")); LOG((CLOG_WARN, "io service not found"));
} }
IOObjectRelease(iter); IOObjectRelease(iter);
} }
else { else {
LOG((CLOG_WARN, "Couldn't obtain IO master port")); LOG((CLOG_WARN, "couldn't get io master port"));
} }
} }
@ -595,7 +595,7 @@ OSXKeyState::setKeyboardModifiers(CGKeyCode virtualKey, bool keyDown)
m_capsPressed = keyDown; m_capsPressed = keyDown;
break; break;
default: default:
LOG((CLOG_DEBUG1 "The key is not a modifier")); LOG((CLOG_DEBUG1 "the key is not a modifier"));
break; break;
} }
} }
@ -653,7 +653,7 @@ OSXKeyState::fakeKey(const Keystroke& keystroke)
setKeyboardModifiers(virtualKey, keyDown); setKeyboardModifiers(virtualKey, keyDown);
if (postHIDVirtualKey(virtualKey, keyDown) != KERN_SUCCESS) { if (postHIDVirtualKey(virtualKey, keyDown) != KERN_SUCCESS) {
LOG((CLOG_WARN, "Fail to post HID event")); LOG((CLOG_WARN, "fail to post hid event"));
postKeyboardKey(virtualKey, keyDown); postKeyboardKey(virtualKey, keyDown);
} }
@ -673,7 +673,7 @@ OSXKeyState::fakeKey(const Keystroke& keystroke)
} }
if(pollActiveGroup() != group) { if(pollActiveGroup() != group) {
LOG((CLOG_WARN "Failed to set new keyboard layout!")); LOG((CLOG_WARN "failed to set new keyboard layout"));
} }
} }
break; break;
@ -934,20 +934,20 @@ OSXKeyState::setGroup(SInt32 group)
{ {
TISInputSourceRef keyboardLayout = (TISInputSourceRef)CFArrayGetValueAtIndex(m_groups.get(), group); TISInputSourceRef keyboardLayout = (TISInputSourceRef)CFArrayGetValueAtIndex(m_groups.get(), group);
if(!keyboardLayout) { if(!keyboardLayout) {
LOG((CLOG_WARN "Nedeed keyboard layout is null")); LOG((CLOG_WARN "nedeed keyboard layout is null"));
return; return;
} }
auto canBeSetted = (CFBooleanRef)TISGetInputSourceProperty(TISCopyCurrentKeyboardInputSource(), kTISPropertyInputSourceIsEnableCapable); auto canBeSetted = (CFBooleanRef)TISGetInputSourceProperty(TISCopyCurrentKeyboardInputSource(), kTISPropertyInputSourceIsEnableCapable);
if(!canBeSetted) { if(!canBeSetted) {
LOG((CLOG_WARN "Nedeed keyboard layout is disabled for programmatically selection")); LOG((CLOG_WARN "nedeed keyboard layout is disabled for programmatically selection"));
return; return;
} }
if(TISSelectInputSource(keyboardLayout) != noErr) { if(TISSelectInputSource(keyboardLayout) != noErr) {
LOG((CLOG_WARN "Failed to set nedeed keyboard layout")); LOG((CLOG_WARN "failed to set nedeed keyboard layout"));
} }
LOG((CLOG_DEBUG1 "Keyboard layout change to %d", group)); LOG((CLOG_DEBUG1 "keyboard layout change to %d", group));
//A minimal delay is needed after a group change because the //A minimal delay is needed after a group change because the
//keyboard key event often happens immediately after. //keyboard key event often happens immediately after.

View file

@ -108,7 +108,7 @@ OSXScreenSaver::processLaunched(ProcessSerialNumber psn)
{ {
if (isScreenSaverEngine(psn)) { if (isScreenSaverEngine(psn)) {
m_screenSaverPSN = psn; m_screenSaverPSN = psn;
LOG((CLOG_DEBUG1 "ScreenSaverEngine launched. Enabled=%d", m_enabled)); LOG((CLOG_DEBUG1 "screen saver engine launched, enabled=%d", m_enabled));
if (m_enabled) { if (m_enabled) {
m_events->addEvent( m_events->addEvent(
Event(m_events->forIPrimaryScreen().screensaverActivated(), Event(m_events->forIPrimaryScreen().screensaverActivated(),
@ -122,7 +122,7 @@ OSXScreenSaver::processTerminated(ProcessSerialNumber psn)
{ {
if (m_screenSaverPSN.highLongOfPSN == psn.highLongOfPSN && if (m_screenSaverPSN.highLongOfPSN == psn.highLongOfPSN &&
m_screenSaverPSN.lowLongOfPSN == psn.lowLongOfPSN) { m_screenSaverPSN.lowLongOfPSN == psn.lowLongOfPSN) {
LOG((CLOG_DEBUG1 "ScreenSaverEngine terminated. Enabled=%d", m_enabled)); LOG((CLOG_DEBUG1 "screen saver engine terminated, enabled=%d", m_enabled));
if (m_enabled) { if (m_enabled) {
m_events->addEvent( m_events->addEvent(
Event(m_events->forIPrimaryScreen().screensaverDeactivated(), Event(m_events->forIPrimaryScreen().screensaverDeactivated(),

View file

@ -501,7 +501,7 @@ XWindowsClipboard::doFillCache()
void void
XWindowsClipboard::icccmFillCache() XWindowsClipboard::icccmFillCache()
{ {
LOG((CLOG_DEBUG "ICCCM fill clipboard %d", m_id)); LOG((CLOG_DEBUG "icccm fill clipboard %d", m_id));
// see if we can get the list of available formats from the selection. // see if we can get the list of available formats from the selection.
// if not then use a default list of formats. note that some clipboard // if not then use a default list of formats. note that some clipboard
@ -579,7 +579,7 @@ XWindowsClipboard::icccmGetSelection(Atom target,
if (!getter.readClipboard(m_display, m_selection, if (!getter.readClipboard(m_display, m_selection,
target, actualTarget, data)) { target, actualTarget, data)) {
LOG((CLOG_DEBUG1 "can't get data for selection target %s", XWindowsUtil::atomToString(m_display, target).c_str())); LOG((CLOG_DEBUG1 "can't get data for selection target %s", XWindowsUtil::atomToString(m_display, target).c_str()));
LOGC(getter.m_error, (CLOG_WARN "ICCCM violation by clipboard owner")); LOGC(getter.m_error, (CLOG_WARN "icccm violation by clipboard owner"));
return false; return false;
} }
else if (*actualTarget == None) { else if (*actualTarget == None) {
@ -688,7 +688,7 @@ XWindowsClipboard::motifOwnsClipboard() const
void void
XWindowsClipboard::motifFillCache() XWindowsClipboard::motifFillCache()
{ {
LOG((CLOG_DEBUG "Motif fill clipboard %d", m_id)); LOG((CLOG_DEBUG "motif fill clipboard %d", m_id));
// get the Motif clipboard header property from the root window // get the Motif clipboard header property from the root window
Atom target; Atom target;

View file

@ -207,7 +207,7 @@ XWindowsKeyState::pollActiveGroup() const
return state.group; return state.group;
} }
LOG((CLOG_WARN "Failed to poll active group")); LOG((CLOG_WARN "failed to poll active group"));
} }
#endif #endif
return 0; return 0;
@ -263,7 +263,7 @@ bool XWindowsKeyState::setCurrentLanguageWithDBus(SInt32 group) const
QDBusInterface screenSaverInterface(service, path, service, bus); QDBusInterface screenSaverInterface(service, path, service, bus);
if (!screenSaverInterface.isValid()) { if (!screenSaverInterface.isValid()) {
LOG((CLOG_WARN "Keyboard layout fail. DBus interface is invalid")); LOG((CLOG_WARN "keyboard layout fail. dbus interface is invalid"));
return false; return false;
} }
@ -272,19 +272,19 @@ bool XWindowsKeyState::setCurrentLanguageWithDBus(SInt32 group) const
if(!reply.isValid()) { if(!reply.isValid()) {
auto qerror = reply.error(); auto qerror = reply.error();
LOG((CLOG_WARN "Keyboard layout fail %s : %s", LOG((CLOG_WARN "keyboard layout fail %s : %s",
qerror.name().toStdString().c_str(), qerror.name().toStdString().c_str(),
qerror.message().toStdString().c_str())); qerror.message().toStdString().c_str()));
return true; return true;
} }
if(reply.isError()) { if(reply.isError()) {
LOG((CLOG_WARN "Keyboard layout fail. reply contains error")); LOG((CLOG_WARN "keyboard layout fail. reply contains error"));
return true; return true;
} }
if(!reply.argumentAt<0>() || reply.argumentAt<1>() != QString("")) { if(!reply.argumentAt<0>() || reply.argumentAt<1>() != QString("")) {
LOG((CLOG_WARN "Keyboard layout fail. Reply is unexpected!")); LOG((CLOG_WARN "keyboard layout fail. Reply is unexpected!"));
return true; return true;
} }
@ -327,7 +327,7 @@ XWindowsKeyState::fakeKey(const Keystroke& keystroke)
if (m_xkb != NULL) { if (m_xkb != NULL) {
if (XkbLockGroup(m_display, XkbUseCoreKbd, if (XkbLockGroup(m_display, XkbUseCoreKbd,
keystroke.m_data.m_group.m_group) == False) { keystroke.m_data.m_group.m_group) == False) {
LOG((CLOG_DEBUG1 "XkbLockGroup request not sent")); LOG((CLOG_DEBUG1 "xkb lock group request not sent"));
} }
} }
else else
@ -348,7 +348,7 @@ XWindowsKeyState::fakeKey(const Keystroke& keystroke)
if (XkbLockGroup(m_display, XkbUseCoreKbd, if (XkbLockGroup(m_display, XkbUseCoreKbd,
getEffectiveGroup(pollActiveGroup(), getEffectiveGroup(pollActiveGroup(),
keystroke.m_data.m_group.m_group)) == False) { keystroke.m_data.m_group.m_group)) == False) {
LOG((CLOG_DEBUG1 "XkbLockGroup request not sent")); LOG((CLOG_DEBUG1 "xkb lock group request not sent"));
} }
} }
else else
@ -622,7 +622,7 @@ XWindowsKeyState::updateKeysymMapXKB(synergy::KeyMap& keyMap)
} }
}; };
LOG((CLOG_DEBUG1 "XKB mapping")); LOG((CLOG_DEBUG1 "xkb mapping"));
// find the number of groups // find the number of groups
int maxNumGroups = 0; int maxNumGroups = 0;

View file

@ -27,7 +27,7 @@ bool sleepInhibitCall(bool state, ArchSystemUnix::InhibitScreenServices serviceI
if (!ArchSystemUnix::DBusInhibitScreenCall(serviceID, state, error)) if (!ArchSystemUnix::DBusInhibitScreenCall(serviceID, state, error))
{ {
LOG((CLOG_DEBUG "DBus inhibit error %s", error.c_str())); LOG((CLOG_DEBUG "dbus inhibit error %s", error.c_str()));
return false; return false;
} }
@ -46,7 +46,7 @@ void XWindowsPowerManager::disableSleep() const
if (!sleepInhibitCall(true, ArchSystemUnix::InhibitScreenServices::kScreenSaver) && if (!sleepInhibitCall(true, ArchSystemUnix::InhibitScreenServices::kScreenSaver) &&
!sleepInhibitCall(true, ArchSystemUnix::InhibitScreenServices::kSessionManager)) !sleepInhibitCall(true, ArchSystemUnix::InhibitScreenServices::kSessionManager))
{ {
LOG((CLOG_INFO "Failed to prevent system from going to sleep")); LOG((CLOG_INFO "failed to prevent system from going to sleep"));
} }
} }
@ -55,6 +55,6 @@ void XWindowsPowerManager::enableSleep() const
if (!sleepInhibitCall(false, ArchSystemUnix::InhibitScreenServices::kScreenSaver) && if (!sleepInhibitCall(false, ArchSystemUnix::InhibitScreenServices::kScreenSaver) &&
!sleepInhibitCall(false, ArchSystemUnix::InhibitScreenServices::kSessionManager)) !sleepInhibitCall(false, ArchSystemUnix::InhibitScreenServices::kSessionManager))
{ {
LOG((CLOG_INFO "Failed to enable system idle sleep")); LOG((CLOG_INFO "failed to enable system idle sleep"));
} }
} }

View file

@ -464,11 +464,11 @@ XWindowsScreen::setOptions(const OptionsList& options)
for (UInt32 i = 0, n = options.size(); i < n; i += 2) { for (UInt32 i = 0, n = options.size(); i < n; i += 2) {
if (options[i] == kOptionXTestXineramaUnaware) { if (options[i] == kOptionXTestXineramaUnaware) {
m_xtestIsXineramaUnaware = (options[i + 1] != 0); m_xtestIsXineramaUnaware = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false")); LOG((CLOG_DEBUG1 "library, XTest is Xinerama unaware %s", m_xtestIsXineramaUnaware ? "true" : "false"));
} }
else if (options[i] == kOptionScreenPreserveFocus) { else if (options[i] == kOptionScreenPreserveFocus) {
m_preserveFocus = (options[i + 1] != 0); m_preserveFocus = (options[i + 1] != 0);
LOG((CLOG_DEBUG1 "Preserve Focus = %s", m_preserveFocus ? "true" : "false")); LOG((CLOG_DEBUG1 "preserve focus: %s", m_preserveFocus ? "true" : "false"));
} }
} }
} }
@ -906,7 +906,7 @@ XWindowsScreen::fakeMouseWheel(SInt32, SInt32 yDelta) const
} }
if (yDelta < m_mouseScrollDelta) { if (yDelta < m_mouseScrollDelta) {
LOG((CLOG_WARN "Wheel scroll delta (%d) smaller than threshold (%d)", yDelta, m_mouseScrollDelta)); LOG((CLOG_WARN "wheel scroll delta (%d) smaller than threshold (%d)", yDelta, m_mouseScrollDelta));
} }
// send as many clicks as necessary // send as many clicks as necessary
@ -929,7 +929,7 @@ XWindowsScreen::openDisplay(const char* displayName)
} }
// open the display // open the display
LOG((CLOG_DEBUG "XOpenDisplay(\"%s\")", displayName)); LOG((CLOG_DEBUG3 "calling XOpenDisplay(\"%s\")", displayName));
Display* display = XOpenDisplay(displayName); Display* display = XOpenDisplay(displayName);
if (display == NULL) { if (display == NULL) {
throw XScreenUnavailable(60.0); throw XScreenUnavailable(60.0);
@ -940,7 +940,7 @@ XWindowsScreen::openDisplay(const char* displayName)
int majorOpcode, firstEvent, firstError; int majorOpcode, firstEvent, firstError;
if (!XQueryExtension(display, XTestExtensionName, if (!XQueryExtension(display, XTestExtensionName,
&majorOpcode, &firstEvent, &firstError)) { &majorOpcode, &firstEvent, &firstError)) {
LOG((CLOG_ERR "XTEST extension not available")); LOG((CLOG_ERR "the XTest extension is not available"));
XCloseDisplay(display); XCloseDisplay(display);
throw XScreenOpenFailure(); throw XScreenOpenFailure();
} }
@ -1479,7 +1479,7 @@ XWindowsScreen::handleSystemEvent(const Event& event, void*)
if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify
|| xevent->type == m_xrandrEventBase + RRNotify || xevent->type == m_xrandrEventBase + RRNotify
&& reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) { && reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) {
LOG((CLOG_INFO "XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received")); LOG((CLOG_INFO "either XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received"));
// we're required to call back into XLib so XLib can update its internal state // we're required to call back into XLib so XLib can update its internal state
XRRUpdateConfiguration(xevent); XRRUpdateConfiguration(xevent);
@ -1818,7 +1818,7 @@ XWindowsScreen::ioErrorHandler(Display*)
// down. X forces us to exit at this point which is annoying. // down. X forces us to exit at this point which is annoying.
// we'll pretend as if we won't exit so we try to make sure we // we'll pretend as if we won't exit so we try to make sure we
// don't access the display anymore. // don't access the display anymore.
LOG((CLOG_CRIT "X display has unexpectedly disconnected")); LOG((CLOG_CRIT "x display has unexpectedly disconnected"));
s_screen->onError(); s_screen->onError();
return 0; return 0;
} }

View file

@ -36,7 +36,7 @@ void ClientProxy1_8::synchronizeLanguages() const
ProtocolUtil::writef(getStream(), kMsgDLanguageSynchronisation, &localLanguages); ProtocolUtil::writef(getStream(), kMsgDLanguageSynchronisation, &localLanguages);
} }
else { else {
LOG((CLOG_ERR "Fail to read server languages")); LOG((CLOG_ERR "failed to read server languages"));
} }
} }

View file

@ -212,7 +212,7 @@ Server::Server(
// Determine if scroll lock is already set. If so, lock the cursor to the primary screen // Determine if scroll lock is already set. If so, lock the cursor to the primary screen
if (m_primaryClient->getToggleMask() & KeyModifierScrollLock) { if (m_primaryClient->getToggleMask() & KeyModifierScrollLock) {
LOG((CLOG_NOTE "Scroll Lock is on, locking cursor to screen")); LOG((CLOG_NOTE "scroll lock is on, locking cursor to screen"));
m_lockedToScreen = true; m_lockedToScreen = true;
} }
@ -431,7 +431,7 @@ Server::isLockedToScreen() const
// locked if we say we're locked // locked if we say we're locked
if (isLockedToScreenServer()) { if (isLockedToScreenServer()) {
LOG((CLOG_NOTE "Cursor is locked to screen, check Scroll Lock key")); LOG((CLOG_NOTE "cursor is locked to screen, check scroll lock key"));
return true; return true;
} }

View file

@ -140,19 +140,19 @@ App::run(int argc, char** argv)
result = e.getCode(); result = e.getCode();
} }
catch (DisplayInvalidException& die) { catch (DisplayInvalidException& die) {
LOG((CLOG_CRIT "A display invalid exception error occurred: %s\n", die.what())); LOG((CLOG_CRIT "a display invalid exception error occurred: %s\n", die.what()));
// display invalid exceptions can occur when going to sleep. When this process exits, the // display invalid exceptions can occur when going to sleep. When this process exits, the
// UI will restart us instantly. We don't really want that behevior, so we quies for a bit // UI will restart us instantly. We don't really want that behevior, so we quies for a bit
ARCH->sleep(10); ARCH->sleep(10);
} }
catch (std::runtime_error& re) { catch (std::runtime_error& re) {
LOG((CLOG_CRIT "A runtime error occurred: %s\n", re.what())); LOG((CLOG_CRIT "a runtime error occurred: %s\n", re.what()));
} }
catch (std::exception& e) { catch (std::exception& e) {
LOG((CLOG_CRIT "An error occurred: %s\n", e.what())); LOG((CLOG_CRIT "an error occurred: %s\n", e.what()));
} }
catch (...) { catch (...) {
LOG((CLOG_CRIT "An unknown error occurred.\n")); LOG((CLOG_CRIT "an unknown error occurred\n"));
} }
appUtil().beforeAppExit(); appUtil().beforeAppExit();

View file

@ -313,7 +313,7 @@ ClientApp::handleClientFailed(const Event& e, void*)
std::unique_ptr<Client::FailInfo> info(static_cast<Client::FailInfo*>(e.getData())); std::unique_ptr<Client::FailInfo> info(static_cast<Client::FailInfo*>(e.getData()));
updateStatus(String("Failed to connect to server: ") + info->m_what + " Trying next address..."); updateStatus(String("Failed to connect to server: ") + info->m_what + " Trying next address...");
LOG((CLOG_NOTE "Failed to connect to server: %s. Trying next address...", info->m_what.c_str())); LOG((CLOG_NOTE "failed to connect to server=%s, trying next address", info->m_what.c_str()));
if (!m_suspended) { if (!m_suspended) {
scheduleClientRestart(nextRestartTimeout()); scheduleClientRestart(nextRestartTimeout());
} }

View file

@ -285,10 +285,10 @@ DaemonApp::mainLoop(bool logToFile, bool foreground)
DAEMON_RUNNING(false); DAEMON_RUNNING(false);
} }
catch (std::exception& e) { catch (std::exception& e) {
LOG((CLOG_CRIT "An error occurred: %s", e.what())); LOG((CLOG_CRIT "an error occurred: %s", e.what()));
} }
catch (...) { catch (...) {
LOG((CLOG_CRIT "An unknown error occurred.\n")); LOG((CLOG_CRIT "an unknown error occurred.\n"));
} }
} }
@ -331,7 +331,8 @@ DaemonApp::handleIpcMessage(const Event& e, void*)
} }
if (!command.empty()) { if (!command.empty()) {
LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str())); LOG((CLOG_DEBUG "daemon got new core command"));
LOG((CLOG_DEBUG2 "new command, elevate=%d command=%s", cm->elevate(), command.c_str()));
std::vector<String> argsArray; std::vector<String> argsArray;
ArgParser::splitCommandString(command, argsArray); ArgParser::splitCommandString(command, argsArray);

View file

@ -346,10 +346,10 @@ SInt32 KeyMap::getLanguageGroupID(SInt32 group, const String& lang) const
auto it = std::find(m_keyboardLayouts.begin(), m_keyboardLayouts.end(), lang); auto it = std::find(m_keyboardLayouts.begin(), m_keyboardLayouts.end(), lang);
if (it != m_keyboardLayouts.end()) { if (it != m_keyboardLayouts.end()) {
id = static_cast<int>(std::distance(m_keyboardLayouts.begin(), it)); id = static_cast<int>(std::distance(m_keyboardLayouts.begin(), it));
LOG((CLOG_DEBUG1 "Language %s has group id %d", lang.c_str(), id)); LOG((CLOG_DEBUG1 "language %s has group id %d", lang.c_str(), id));
} }
else { else {
LOG((CLOG_DEBUG1 "Could not found requested language")); LOG((CLOG_DEBUG1 "could not found requested language"));
} }
return id; return id;

View file

@ -890,7 +890,7 @@ KeyState::fakeKeys(const Keystrokes& keys, UInt32 count)
++k; ++k;
} }
else { else {
LOG((CLOG_DEBUG1 "Skipping keystroke (because language sync is disabled)")); LOG((CLOG_DEBUG1 "skipping keystroke, language sync is disabled"));
++k; ++k;
} }
} }

View file

@ -144,7 +144,7 @@ ProtocolUtil::vwritef(synergy::IStream* stream,
LOG((CLOG_DEBUG2 "wrote %d bytes", size)); LOG((CLOG_DEBUG2 "wrote %d bytes", size));
} }
catch (const XBase& exception) { catch (const XBase& exception) {
LOG((CLOG_DEBUG2 "Exception <%s> during wrote %d bytes into stream", exception.what(), size)); LOG((CLOG_DEBUG2 "exception <%s> during wrote %d bytes into stream", exception.what(), size));
throw; throw;
} }
} }
@ -519,8 +519,8 @@ void ProtocolUtil::readBytes(synergy::IStream * stream, UInt32 len, String* dest
} }
catch (std::bad_alloc & exception) { catch (std::bad_alloc & exception) {
// Added try catch due to GHSA-chfm-333q-gfpp // Added try catch due to GHSA-chfm-333q-gfpp
LOG((CLOG_ERR "ALLOC: Unable to allocate memory %d bytes", len)); LOG((CLOG_ERR "bad alloc, unable to allocate memory %d bytes", len));
LOG((CLOG_DEBUG "bad_alloc detected: Do you have enough free memory?")); LOG((CLOG_DEBUG "bad_alloc detected: is there enough memory?"));
throw exception; throw exception;
} }
} }

View file

@ -82,11 +82,11 @@ ToolApp::run(int argc, char** argv)
} }
} }
catch (std::exception& e) { catch (std::exception& e) {
LOG((CLOG_CRIT "An error occurred: %s\n", e.what())); LOG((CLOG_CRIT "an error occurred: %s\n", e.what()));
return kExitFailed; return kExitFailed;
} }
catch (...) { catch (...) {
LOG((CLOG_CRIT "An unknown error occurred.\n")); LOG((CLOG_CRIT "an unknown error occurred\n"));
return kExitFailed; return kExitFailed;
} }

View file

@ -42,7 +42,7 @@ namespace languages {
LanguageManager::LanguageManager(const std::vector<String>& localLanguages) : LanguageManager::LanguageManager(const std::vector<String>& localLanguages) :
m_localLanguages(localLanguages) m_localLanguages(localLanguages)
{ {
LOG((CLOG_INFO "Local languages: %s", vectorToString(m_localLanguages, ", ").c_str())); LOG((CLOG_INFO "local languages: %s", vectorToString(m_localLanguages, ", ").c_str()));
} }
void LanguageManager::setRemoteLanguages(const String& remoteLanguages) void LanguageManager::setRemoteLanguages(const String& remoteLanguages)
@ -53,7 +53,7 @@ void LanguageManager::setRemoteLanguages(const String& remoteLanguages)
m_remoteLanguages.push_back(remoteLanguages.substr(i, 2)); m_remoteLanguages.push_back(remoteLanguages.substr(i, 2));
} }
} }
LOG((CLOG_INFO "Remote languages: %s", vectorToString(m_remoteLanguages, ", ").c_str())); LOG((CLOG_INFO "remote languages: %s", vectorToString(m_remoteLanguages, ", ").c_str()));
} }
const std::vector<String>& LanguageManager::getRemoteLanguages() const const std::vector<String>& LanguageManager::getRemoteLanguages() const

View file

@ -109,13 +109,13 @@ AppUtilUnix::getCurrentLanguageCode()
auto display = XOpenDisplay(nullptr); auto display = XOpenDisplay(nullptr);
if (!display) { if (!display) {
LOG((CLOG_WARN "Failed to open x11 default display")); LOG((CLOG_WARN "failed to open x11 default display"));
return result; return result;
} }
auto kbdDescr= XkbAllocKeyboard(); auto kbdDescr= XkbAllocKeyboard();
if (!kbdDescr) { if (!kbdDescr) {
LOG((CLOG_WARN "Failed to get x11 keyboard description")); LOG((CLOG_WARN "failed to get x11 keyboard description"));
return result; return result;
} }
XkbGetNames(display, XkbSymbolsNameMask, kbdDescr); XkbGetNames(display, XkbSymbolsNameMask, kbdDescr);
@ -174,24 +174,24 @@ void
AppUtilUnix::showNotification(const String & title, const String & text) const AppUtilUnix::showNotification(const String & title, const String & text) const
{ {
#if WINAPI_XWINDOWS #if WINAPI_XWINDOWS
LOG((CLOG_INFO "Showing notification. Title: \"%s\". Text: \"%s\"", title.c_str(), text.c_str())); LOG((CLOG_INFO "showing notification, title=\"%s\", text=\"%s\"", title.c_str(), text.c_str()));
if (!notify_init("Synergy")) if (!notify_init("Synergy"))
{ {
LOG((CLOG_INFO "Failed to initialize libnotify")); LOG((CLOG_INFO "failed to initialize libnotify"));
return; return;
} }
auto notification = notify_notification_new (title.c_str(), text.c_str(), nullptr); auto notification = notify_notification_new (title.c_str(), text.c_str(), nullptr);
if (notification == nullptr) if (notification == nullptr)
{ {
LOG((CLOG_INFO "Failed to create notification")); LOG((CLOG_INFO "failed to create notification"));
return; return;
} }
notify_notification_set_timeout(notification, 10000); notify_notification_set_timeout(notification, 10000);
if (!notify_notification_show(notification, nullptr)) if (!notify_notification_show(notification, nullptr))
{ {
LOG((CLOG_INFO "Failed to show notification")); LOG((CLOG_INFO "failed to show notification"));
} }
g_object_unref(G_OBJECT(notification)); g_object_unref(G_OBJECT(notification));
@ -200,6 +200,6 @@ AppUtilUnix::showNotification(const String & title, const String & text) const
#elif WINAPI_CARBON #elif WINAPI_CARBON
// synergys and synergyc are not allowed to send native notifications on MacOS // synergys and synergyc are not allowed to send native notifications on MacOS
// instead ask main synergy process to show them instead // instead ask main synergy process to show them instead
LOG((CLOG_INFO "OSX Notification: %s|%s", title.c_str(), text.c_str())); LOG((CLOG_INFO "mac notification: %s|%s", title.c_str(), text.c_str()));
#endif #endif
} }

View file

@ -33,11 +33,11 @@ SynergyXkbKeyboard::SynergyXkbKeyboard()
if (display) { if (display) {
if (!XkbRF_GetNamesProp(display.get(), nullptr, &m_data)) { if (!XkbRF_GetNamesProp(display.get(), nullptr, &m_data)) {
LOG((CLOG_WARN "Error reading keyboard layouts")); LOG((CLOG_WARN "error reading keyboard layouts"));
} }
} }
else { else {
LOG((CLOG_WARN "Can't open Xkb display during reading languages")); LOG((CLOG_WARN "can't open xkb display during reading languages"));
} }
} }

View file

@ -46,7 +46,7 @@ X11LayoutsParser::readXMLConfigItemElem(const pugi::xml_node* root, std::vector<
{ {
auto configItemElem = root->child("configItem"); auto configItemElem = root->child("configItem");
if(!configItemElem) { if(!configItemElem) {
LOG((CLOG_WARN "Failed to read \"configItem\" in xml file")); LOG((CLOG_WARN "failed to read \"configItem\" in xml file"));
return false; return false;
} }
@ -72,19 +72,19 @@ X11LayoutsParser::getAllLanguageData(const String& pathToEvdevFile)
std::vector<Lang> allCodes; std::vector<Lang> allCodes;
pugi::xml_document doc; pugi::xml_document doc;
if(!doc.load_file(pathToEvdevFile.c_str())) { if(!doc.load_file(pathToEvdevFile.c_str())) {
LOG((CLOG_WARN "Failed to open %s", pathToEvdevFile.c_str())); LOG((CLOG_WARN "failed to open %s", pathToEvdevFile.c_str()));
return allCodes; return allCodes;
} }
auto xkbConfigElem = doc.child("xkbConfigRegistry"); auto xkbConfigElem = doc.child("xkbConfigRegistry");
if(!xkbConfigElem) { if(!xkbConfigElem) {
LOG((CLOG_WARN "Failed to read xkbConfigRegistry in %s", pathToEvdevFile.c_str())); LOG((CLOG_WARN "failed to read xkbConfigRegistry in %s", pathToEvdevFile.c_str()));
return allCodes; return allCodes;
} }
auto layoutListElem = xkbConfigElem.child("layoutList"); auto layoutListElem = xkbConfigElem.child("layoutList");
if(!layoutListElem) { if(!layoutListElem) {
LOG((CLOG_WARN "Failed to read layoutList in %s", pathToEvdevFile.c_str())); LOG((CLOG_WARN "failed to read layoutList in %s", pathToEvdevFile.c_str()));
return allCodes; return allCodes;
} }
@ -121,7 +121,7 @@ X11LayoutsParser::convertLayoutToISO639_2(const String& pathToEvdevFile,
std::vector<String>& iso639_2Codes) std::vector<String>& iso639_2Codes)
{ {
if(layoutNames.size() != layoutVariantNames.size()) { if(layoutNames.size() != layoutVariantNames.size()) {
LOG((CLOG_WARN "Error in language layout or language layout variants list")); LOG((CLOG_WARN "error in language layout or language layout variants list"));
return; return;
} }
@ -133,7 +133,7 @@ X11LayoutsParser::convertLayoutToISO639_2(const String& pathToEvdevFile,
const auto& layoutName = layoutNames[i]; const auto& layoutName = layoutNames[i];
auto langIter = std::find_if(allLang.begin(), allLang.end(), [&layoutName](const Lang& l) {return l.name == layoutName;}); auto langIter = std::find_if(allLang.begin(), allLang.end(), [&layoutName](const Lang& l) {return l.name == layoutName;});
if(langIter == allLang.end()) { if(langIter == allLang.end()) {
LOG((CLOG_WARN "Language \"%s\" is unknown", layoutNames[i].c_str())); LOG((CLOG_WARN "language \"%s\" is unknown", layoutNames[i].c_str()));
continue; continue;
} }
@ -146,7 +146,7 @@ X11LayoutsParser::convertLayoutToISO639_2(const String& pathToEvdevFile,
auto langVariantIter = std::find_if(langIter->variants.begin(), langIter->variants.end(), auto langVariantIter = std::find_if(langIter->variants.begin(), langIter->variants.end(),
[&variantName](const Lang& l) {return l.name == variantName;}); [&variantName](const Lang& l) {return l.name == variantName;});
if(langVariantIter == langIter->variants.end()) { if(langVariantIter == langIter->variants.end()) {
LOG((CLOG_WARN "Variant \"%s\" of language \"%s\" is unknown", layoutVariantNames[i].c_str(), layoutNames[i].c_str())); LOG((CLOG_WARN "variant \"%s\" of language \"%s\" is unknown", layoutVariantNames[i].c_str(), layoutNames[i].c_str()));
continue; continue;
} }
@ -186,13 +186,13 @@ X11LayoutsParser::convertLayotToISO(const String& pathToEvdevFile, const String&
std::vector<String> iso639_2Codes; std::vector<String> iso639_2Codes;
convertLayoutToISO639_2(pathToEvdevFile, needToReloadFiles, {layoutLangCode}, {""}, iso639_2Codes); convertLayoutToISO639_2(pathToEvdevFile, needToReloadFiles, {layoutLangCode}, {""}, iso639_2Codes);
if(iso639_2Codes.empty()) { if(iso639_2Codes.empty()) {
LOG((CLOG_WARN "Failed to convert layout lang code! Code: \"%s\"", layoutLangCode.c_str())); LOG((CLOG_WARN "failed to convert layout lang code: \"%s\"", layoutLangCode.c_str()));
return ""; return "";
} }
auto iso639_1Codes = convertISO639_2ToISO639_1(iso639_2Codes); auto iso639_1Codes = convertISO639_2ToISO639_1(iso639_2Codes);
if(iso639_1Codes.empty()) { if(iso639_1Codes.empty()) {
LOG((CLOG_WARN "Failed to convert ISO639/2 lang code to ISO639/1!")); LOG((CLOG_WARN "failed to convert ISO639/2 lang code to ISO639/1"));
return ""; return "";
} }
@ -207,7 +207,7 @@ X11LayoutsParser::convertISO639_2ToISO639_1(const std::vector<String>& iso639_2C
const auto& tableIter = std::find_if(ISO_Table.begin(), ISO_Table.end(), const auto& tableIter = std::find_if(ISO_Table.begin(), ISO_Table.end(),
[&isoCode](const std::pair<String, String>& c) {return c.first == isoCode;}); [&isoCode](const std::pair<String, String>& c) {return c.first == isoCode;});
if(tableIter == ISO_Table.end()) { if(tableIter == ISO_Table.end()) {
LOG((CLOG_WARN "ISO 639-2 code \"%s\" is missed in table", isoCode.c_str())); LOG((CLOG_WARN "the ISO 639-2 code \"%s\" is missed in table", isoCode.c_str()));
continue; continue;
} }

View file

@ -230,7 +230,7 @@ HKL AppUtilWindows::getCurrentKeyboardLayout() const
layout = GetKeyboardLayout(GetWindowThreadProcessId(gti.hwndActive, NULL)); layout = GetKeyboardLayout(GetWindowThreadProcessId(gti.hwndActive, NULL));
} }
else { else {
LOG((CLOG_WARN "Failed to determine current keyboard layout")); LOG((CLOG_WARN "failed to determine current keyboard layout"));
} }
return layout; return layout;
@ -249,9 +249,9 @@ public:
void void
AppUtilWindows::showNotification(const String & title, const String & text) const AppUtilWindows::showNotification(const String & title, const String & text) const
{ {
LOG((CLOG_INFO "Showing notification. Title: \"%s\". Text: \"%s\"", title.c_str(), text.c_str())); LOG((CLOG_INFO "showing notification, title=\"%s\", text=\"%s\"", title.c_str(), text.c_str()));
if (!WinToastLib::WinToast::isCompatible()) { if (!WinToastLib::WinToast::isCompatible()) {
LOG((CLOG_INFO "This system does not support toast notifications")); LOG((CLOG_INFO "this system does not support toast notifications"));
return; return;
} }
if (!WinToastLib::WinToast::instance()->isInitialized()) if (!WinToastLib::WinToast::instance()->isInitialized())
@ -262,7 +262,7 @@ AppUtilWindows::showNotification(const String & title, const String & text) cons
if (!WinToastLib::WinToast::instance()->initialize()) if (!WinToastLib::WinToast::instance()->initialize())
{ {
LOG((CLOG_DEBUG "Failed to initialize toast notifications")); LOG((CLOG_DEBUG "failed to initialize toast notifications"));
return; return;
} }
} }
@ -275,7 +275,7 @@ AppUtilWindows::showNotification(const String & title, const String & text) cons
const bool launched = WinToastLib::WinToast::instance()->showToast(templ, handler.get(), &error); const bool launched = WinToastLib::WinToast::instance()->showToast(templ, handler.get(), &error);
if (!launched) { if (!launched) {
LOG((CLOG_DEBUG "Failed to show toast notification. Error code: %d", error)); LOG((CLOG_DEBUG "failed to show toast notification, error code: %d", error));
return; return;
} }
} }