richibrics / IoTuring

Your Windows, Linux, macOS computer as MQTT and HomeAssistant integration
https://pypi.org/project/IoTuring/
GNU General Public License v3.0
70 stars 6 forks source link

Implement Configuration and Log dirs classes #61

Open richibrics opened 1 year ago

richibrics commented 1 year ago

PR that simplifies the selection of directories based on

The GetDirectory class must be extended and the subclasses only have to specify the methods to retrieve

and two variables

Reimplemented Configurations path selection with the new class and implemented the same for Logs

richibrics commented 1 year ago

Now I need to find Logs folders for Windows and Linux.

On macOS now it works correctly and Logs can be found also from the Console app.

infeeeee commented 1 year ago

On Linux:

There is no standard in the XDG spec for logs, I would place it in $XDG_CACHE_HOME, and fallback to $HOME/.cache, as the first answer recommends it here: https://superuser.com/questions/1293842/where-should-userspecific-application-log-files-be-stored-in-gnu-linux

But logging to file on Linux nowadays is not really important. A continuously running process like this should be managed by systemd, which has a robust logging system called journald, and it records everything sent to stdout. But there are still some distros not using systemd, for them this should be useful.

On Windows:

I have seen other programs simply log into %appdata%. A bit more elegant solution would be to %localappdata%. The difference is if roaming profiles enabled in a company network, content from %appdata% should be copied with the user, while %localappdata% stays on the machine. Roaming profiles are not enabled even on most companies (at least I've never seen a working one) so this doesn't really matter most of the times.

richibrics commented 1 year ago

Great, thank you for the explanations !