Skip to content

refactor: coreArgs, log is a persistent option, making it now optional - #9032

Closed
sithlord48 wants to merge 1 commit into
masterfrom
logFile
Closed

refactor: coreArgs, log is a persistent option, making it now optional#9032
sithlord48 wants to merge 1 commit into
masterfrom
logFile

Conversation

@sithlord48

@sithlord48 sithlord48 commented Oct 13, 2025

Copy link
Copy Markdown
Member

Currently when deskflow-core is started it will write to the settings if it does or does not have the --log option. (used to set the log file and that we are logging to a file) . if you run without --log you will get an internal log. This means unlike our other settings having log or not always changes the settings file. This aligns our log to be like our other settings where when present it sets the option otherwise uses the setting already in the file.

  • deskflow-core <mode> --log=internal will reset to not use a file
  • deskflow-core <mode> --log=someFile will use the log file
  • No reason to set a default log file path.

@sithlord48
sithlord48 requested a review from nbolton October 13, 2025 14:21
} else {
Settings::setValue(Settings::Log::ToFile, false);
const auto value = m_parser.value(CoreArgs::logFileOption);
if (value == QStringLiteral("internal")) {

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.

Just thinking out loud... this seems a bit weird. Why not just have no log arg means use internal logging? Why would anyone set --log=internal?

@sithlord48 sithlord48 Oct 13, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It gives you a way from the CLI to reset where the log goes. Otherwise you need to open the settings to change the setting after.

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.

I see. It's still a bit weird though. I believe this is a symptom of having CLI args that persist, which is unusual and counter-intuitive.

If I understand correctly, --log currently persists into settings, which breaks the expected contract of CLI arguments. Users will expect command-line flags should act as ephemeral overrides for a single run, not silently rewrite durable configuration. This creates hidden side effects that are hard for users to track or reason about, and has created the problem you're trying to solve now.

The design is further weakened by overloading --log with two different meanings. In one case it is a file path, in another it is the special keyword 'internal'. A string argument should either represent a path or be empty, not a path sometimes and a reserved keyword at other times. This ambiguity increases complexity for both users and maintainers.

There are three potential ways forward:

  1. Keep the persistence and let a bare --log write an empty string to clear the setting, which still leaves the problem of CLI mutating config -- this is my lest favourite as it's still not very intuitive, but it's a quick fix.
  2. Drop CLI logging arguments altogether and require all persistence to be handled in config or UI -- this is the least expensive to maintain.
  3. Keep CLI arguments but make them non-persistent, so they only override the config for the current run without saving changes.

The third option is the most consistent and least surprising. CLI args would remain a tool for transient overrides which is a common pattern, configuration files would hold durable state, and persistence would only happen when explicitly requested through config set or config unset. This separation of concerns avoids the confusion in the current design.

@sithlord48 sithlord48 Oct 14, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

All our options in the core presist now.

  1. That is way more akward so im gonna say no
  2. The Gui is not and should not be a requirement to run deskflow.
  3. means passing arg and not using the settings in the core (Replace CLI args with Qt settings file read in Core #8852)

Remember this ONLY will be for users directly using the core without the gui

@sithlord48 sithlord48 Oct 14, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Non of the CLI options are needed and we can tell ppl to modify the configuration file then re run..
we could even remove the mode and this can come from settings . basicly the only options needed in core are

  • -h --help used to generate man and list valid options / use
  • -v --version report the version (as used for man)
  • -s --settings Settings file to use
  • --setup todo , a cli wizard to configure w/o the gui

All other setting are only for configuration that would be otherwise handled by the core,

In the future we remove the --log option completely and write to a temp file for our log. this will be needed to inject the log into random GUI instances when #8879 will need this anyway (at least if we continue to show the log within the app , something i think we can also remove after #8257 )

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.

  • The Gui is not and should not be a requirement to run deskflow.

That's not what I'm suggesting. Editing a config file is trivial; no GUI required.

we can tell ppl to modify the configuration file

Yes, this is what I was suggesting.

@sithlord48

Copy link
Copy Markdown
Member Author

Replaced by #9040

@sithlord48 sithlord48 closed this Oct 14, 2025
@sithlord48
sithlord48 deleted the logFile branch November 2, 2025 13:02
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.

2 participants