Refactor logging configuration to use AppData directory

- Updated config.example.json to set default log_file to null.
- Modified config.py to resolve log file paths relative to the AppData directory.
- Added methods to get default log directory and log file path in AppData.
- Ensured logging behavior is consistent whether a log_file is specified or not.
This commit is contained in:
claudi 2026-02-20 07:45:21 +01:00
parent b3fd61aed2
commit a8aa54fa5e
8 changed files with 2932 additions and 2884 deletions

View file

@ -103,6 +103,13 @@ Z:\aN5PysnXIuRECzcRbvHkjL7g0\Hintergrund_Agravity.png
- Options: `"DEBUG"`, `"INFO"`, `"WARNING"`, `"ERROR"`, `"CRITICAL"`
- Default: `"INFO"`
- **`log_file`** (string, optional): Path to log file
- If `null` or not specified: Logs to `%APPDATA%\webdrop_bridge\logs\webdrop_bridge.log` (Windows) or `~/.local/share/webdrop_bridge/logs/webdrop_bridge.log` (macOS/Linux)
- If relative path: Resolved relative to the app data directory (same as above location)
- If absolute path: Used as-is
- Default: `null` (uses AppData directory for permissions compatibility)
- **Important**: Logs are always stored in the user's AppData directory to ensure the app can write logs in both development and installed scenarios
- **`enable_logging`** (boolean): Whether to write logs to file
- Default: `true`