Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow xdg base directory specification for log files (instead of $TMPDIR) #2215

Closed
ultimatespirit opened this issue Apr 28, 2024 · 2 comments · Fixed by #2259
Closed

Follow xdg base directory specification for log files (instead of $TMPDIR) #2215

ultimatespirit opened this issue Apr 28, 2024 · 2 comments · Fixed by #2259
Assignees
Labels
enhancement Staged Feature Complete and in Testing for Next Release
Milestone

Comments

@ultimatespirit
Copy link

Describe the enhancement

Would it be possible to change the log file directory location (currently $TMPDIR) to use the XDG Base Directory Specification? Or at least have an option to change it in the configuration file, or at runtime (via a flag, not an env variable) if the log directory info is needed before configurations can be read.

It's not clear to me how transient those log files are meant to be (since by default they reside in /tmp which would get cleared every reboot at least), so either $XDG_STATE_HOME (more persistent, but not generally a candidate for backups) or $XDG_CACHE_HOME (closest to /tmp) would fit it seems.

For what it's worth, since presumably EDMC must be reading the environment to begin with somewhere, something like env.get("TMPDIR", env.get("XDG_CACHE_HOME", "/tmp") could perhaps do this semi-hackily with minimal churn (where it is assumed env is a dictionary of the environment). So any users who had explicitly set $TMPDIR and also have whichever XDG directory is chosen (between state and cache) set wouldn't see changes in behaviour.

Expected behavior
More or less explained above.

Considered workarounds

Just export TMPDIR=$XDG_CACHE_HOME, though I'd like to avoid this if possible (more variable pollution).

Alternatively launch EDMC with TMPDIR=... ./EDMark... every time.

Additional context

I mostly found it strange how the config and plugin locations properly respected the XDG spec but not the log directory, thus this ask.

@Rixxan
Copy link
Contributor

Rixxan commented Apr 28, 2024

Probably worth moving all logging out of the temp dirs globally.

@Rixxan Rixxan added this to the 6.0.0 milestone May 1, 2024
@Rixxan
Copy link
Contributor

Rixxan commented Jun 10, 2024

For this one, I think it makes more sense to make a new dir in app_dir_path (Linux: ~/.local/share/edmarketconnector/logs, Windows: %localappdata%/edmarketconnector/logs) to house this information. This keeps things unified as to where they will be (same place as plugins, fdevid files, etc) rather than scattering information all across the file system.

@Rixxan Rixxan modified the milestones: 6.0, Pre-6.0 Changes, 5.12 Jun 10, 2024
@Rixxan Rixxan linked a pull request Jun 10, 2024 that will close this issue
@Rixxan Rixxan self-assigned this Jun 10, 2024
@Rixxan Rixxan added the Staged Feature Complete and in Testing for Next Release label Jul 22, 2024
@Rixxan Rixxan closed this as completed Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Staged Feature Complete and in Testing for Next Release
Projects
Status: Complete
Development

Successfully merging a pull request may close this issue.

2 participants