Skip to content

Sync log level in gui and core - #8885

Merged
nbolton merged 3 commits into
masterfrom
syncLogLevelInGuiAndCore
Aug 27, 2025
Merged

Sync log level in gui and core#8885
nbolton merged 3 commits into
masterfrom
syncLogLevelInGuiAndCore

Conversation

@sithlord48

@sithlord48 sithlord48 commented Aug 23, 2025

Copy link
Copy Markdown
Member

In order to get the core nicely working without using any switches. we need to first allow the GUI to work with any log level not just INFO +. This Pr Does this by doing two things

  1. Allow the GUI settings to show and save from Fatal - Debug2 Levels.
  2. Move all the essential messages needed for GUI function to the IPC Level
  3. Fixes Notify user that logs may be impacting performance #8889 by adding tooltips to the log level area and each entry

The second point can be undone when we have better IPC Until the gui has to see these messages.

Testing but setting the gui to FATAL and trying various connections anf key checks etc.. there is some INFO printed at start but i think we don't apply the log level before these messages.? happens when the core is started up or restarted maybe worth looking into in another pr ?

@nbolton I may need you to double check i've not messed any messages we need or added any we don't.

Added a label that shows when you have set the log below INFO

The Debug levels may affect performance. Only change the log level to one below Info if you are attempting to debug an issue or are gathering logs to submit with a bug report.

Each levels tooltip:

  • Fatal Required messages
  • Error Non-fatal errors
  • Warning General warnings
  • Note Notable events
  • Info General events [Default]
  • Debug Debug entries
  • Debug1 More debug output
  • Debug2 Verbose debug output

@sithlord48
sithlord48 force-pushed the syncLogLevelInGuiAndCore branch from 049886c to 28655ec Compare August 23, 2025 18:00
@sithlord48
sithlord48 requested a review from nbolton August 23, 2025 18:01
@sithlord48
sithlord48 marked this pull request as ready for review August 23, 2025 20:20
@nbolton

nbolton commented Aug 25, 2025

Copy link
Copy Markdown
Member

I need to have a think about this, I'm not quite sure I understand why this is necessary and what problem it solves.

@sithlord48

sithlord48 commented Aug 25, 2025

Copy link
Copy Markdown
Member Author

Two problems
1 when removing the -d switch from core the lowest settings can show now is INFO. to keep the setting the same in the core we need to allow the gui to also have levels of Fatal , Error and Warning.
2. if you just let it show Fatal the gui does not work correct as we listen for messages at the Info Level . I was going to move them to PRINT but making them their own IPC allows me to re add the time stamp back into the message w/o forcing it for all other print messages.

  1. see the linked bug / feature report

@nbolton

nbolton commented Aug 26, 2025

Copy link
Copy Markdown
Member

Using a special IPC log level to force the GUI to keep working at low verbosity is the wrong fix, because it turns human-oriented logs into a control channel and tightens coupling; #8889 is a UI problem that can be solved in the GUI with a clear warning or confirm step when choosing verbose levels, while the Core should stay decoupled and expose state via a proper event stream instead (for example messages over Qt local serverwith events like Connecting, Connected, Disconnected, PeerFingerprint) that the GUI can subscribe to independent of log level; keep logs for people, send state over real IPC, and ship the UI warning now with a follow-up to add structured events and most importantly... we must remove all GUI log scraping (this is the correct fix).

@sithlord48

sithlord48 commented Aug 26, 2025

Copy link
Copy Markdown
Member Author

The second point can be undone when we have better IPC Until then gui has to see these messages.

Yes I plan to remove this when we have working IPC. can just revert the commit even that is why its its own commit so we can remove it later easily

Using a special IPC log level to force the GUI to keep working at low verbosity is the wrong fix, because it turns human-oriented logs into a control channel and tightens coupling;

We already are using the log messages but they are printed at INFO meaning if you set the level higher (i.e Note or Fatal ) the gui stops working correctly. I have not changed how it works just that you cant filter the messages now in the gui while being able to filter with the same levels you can from the cli

This blocks me removing the args until we have IPC this is what we need todo do. Proper IPC its blocked by our core apps not having a QEvent loop , that is blocked by having Args and making our own 'App' class removing the args lets me remove the whole run , runInnter stuff that gets us closer to one event loop not ours + Qts

@sithlord48
sithlord48 force-pushed the syncLogLevelInGuiAndCore branch 4 times, most recently from 43b158d to 022d3e9 Compare August 26, 2025 13:54
@nbolton

nbolton commented Aug 27, 2025

Copy link
Copy Markdown
Member

Yes I plan to remove this when we have working IPC.

Got it, not sure if we have an issue already, but I raised this so we don't forget:

This blocks me removing the args until we have IPC this is what we need todo do. Proper IPC its blocked by our core apps not having a QEvent loop , that is blocked by having Args and making our own 'App' class removing the args lets me remove the whole run , runInnter stuff that gets us closer to one event loop not ours + Qts

Makes sense.

@nbolton nbolton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why but I am seeing:

[2025-08-27T09:47:57] INFO: running command: /home/nick/Projects/deskflow/build/bin/deskflow-core server -f --debug INFO --name spock-tux --enable-crypto --prevent-sleep --log /home/nick/deskflow.log --address :24800 -c /home/nick/.config/Deskflow/deskflow-server.conf --tls-cert /home/nick/.config/Deskflow/tls/deskflow.pem
	/home/nick/Projects/deskflow/src/lib/gui/core/CoreProcess.cpp:248
[2025-08-27T09:47:57] DEBUG: core process state changed: starting -> started
	/home/nick/Projects/deskflow/src/lib/gui/core/CoreProcess.cpp:612
[2025-08-27T09:47:57] INFO: using ei screen for wayland
	/home/nick/Projects/deskflow/src/lib/deskflow/ServerApp.cpp:483
[2025-08-27T09:47:57] DEBUG: core connection state changed:  3
	/home/nick/Projects/deskflow/src/lib/gui/MainWindow.cpp:1059
[2025-08-27T09:47:57] NOTE: started server, waiting for clients
	/home/nick/Projects/deskflow/src/lib/deskflow/ServerApp.cpp:443
deskflow-core: /home/nick/Projects/deskflow/src/lib/base/Log.cpp:295: void Log::output(LogLevel, const char*): Assertion `static
_cast<int>(priority) >= -1 && static_cast<int>(priority) < g_numPriority' failed.

Maybe a bug only in debug build?

Comment thread src/lib/common/Settings.cpp
Comment thread src/lib/gui/dialogs/SettingsDialog.ui Outdated
@sithlord48
sithlord48 force-pushed the syncLogLevelInGuiAndCore branch 2 times, most recently from 0230273 to dd20c82 Compare August 27, 2025 14:07
@sithlord48

Copy link
Copy Markdown
Member Author

Our Debug level is weird.. also you can see we still get some INFO lines in FATAL around start up / shutdown i suspect these messages are before the level is set in the new instance of the core.

@sithlord48
sithlord48 force-pushed the syncLogLevelInGuiAndCore branch from dd20c82 to aec987f Compare August 27, 2025 14:13
@sithlord48

Copy link
Copy Markdown
Member Author

deskflow-core: /home/nick/Projects/deskflow/src/lib/base/Log.cpp:295: void Log::output(LogLevel, const char*): Assertion `static
_cast(priority) >= -1 && static_cast(priority) < g_numPriority' failed.

I Just Fixed this i missed that assert.

@nbolton
nbolton force-pushed the syncLogLevelInGuiAndCore branch from aec987f to 0efde0f Compare August 27, 2025 23:28
@nbolton
nbolton enabled auto-merge (rebase) August 27, 2025 23:28
@nbolton
nbolton merged commit 4e8a679 into master Aug 27, 2025
31 checks passed
@nbolton
nbolton deleted the syncLogLevelInGuiAndCore branch August 27, 2025 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notify user that logs may be impacting performance

2 participants