Skip to content

feat: Enhance custom Logger with error handling and persistence features#31

Merged
SmilingPixel merged 12 commits into
mainfrom
feat/logging_system_0610
Jun 29, 2026
Merged

feat: Enhance custom Logger with error handling and persistence features#31
SmilingPixel merged 12 commits into
mainfrom
feat/logging_system_0610

Conversation

@SmilingPixel

Copy link
Copy Markdown
Owner

This pull request introduces a comprehensive diagnostics and logging system to the application, focusing on configurable log levels, persistent log storage, and user-facing log export/clear features. The changes span both core logic and Android-specific integration, enabling users to control logging behavior and export logs for troubleshooting directly from the app's settings.

Diagnostics and Logging Functionality

  • Added a cross-platform Logger API with support for configurable log levels, persistent log storage, and log export/clear operations. The Android implementation persists logs to local storage, supports log rotation, and uses the Android share sheet for exporting logs. (composeApp/src/commonMain/kotlin/io/github/smiling_pixel/util/Logger.kt, composeApp/src/androidMain/kotlin/io/github/smiling_pixel/util/Logger.android.kt) [1] [2]
  • Introduced the LogExportResult sealed interface to standardize log export outcomes across platforms.
  • Updated the AutoSync.android.kt module to use the new Logger for error reporting instead of direct Android logging. [1] [2]

User Settings and UI Integration

  • Extended the SettingsRepository interface to support reactive flows and setters for log level and log persistence, allowing users to configure these diagnostics settings.
  • Enhanced the SettingsScreen UI with a new Diagnostics section, enabling users to select log level, toggle log persistence, export logs, and clear logs. The UI provides immediate feedback on diagnostics actions. [1] [2]
  • Updated the main App composable to reactively apply user-selected log settings to the Logger at runtime.

Android Platform Integration

  • Integrated AndroidX Core KTX and added a FileProvider to the manifest and resources, enabling secure sharing of exported log files. [1] [2] [3]
  • Updated documentation to describe the Android log export mechanism and associated build/manifest requirements.

These changes collectively provide robust diagnostics capabilities, improve troubleshooting, and empower users and developers to control and access application logs safely.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a cross-platform diagnostics/logging system with configurable log levels, optional persisted log storage, and user-facing export/clear controls, integrating into Settings and platform-specific implementations (Android/JVM/Wasm).

Changes:

  • Added a new Logger expect/actual API with log level filtering, optional persistence, and LogExportResult for export outcomes.
  • Extended SettingsRepository with reactive log-level and persistence settings, wiring them through Settings UI and App startup.
  • Implemented Android/JVM persisted logging + export mechanisms (FileProvider share on Android, file chooser export on JVM), and updated AutoSync to use the new logger.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/util/Logger.kt Defines the cross-platform Logger API, log levels, export result model, and helper extensions.
composeApp/src/androidMain/kotlin/io/github/smiling_pixel/util/Logger.android.kt Android logger implementation with persistence, rotation, and share-sheet export via FileProvider.
composeApp/src/jvmMain/kotlin/io/github/smiling_pixel/util/Logger.jvm.kt JVM logger implementation with persistence, rotation, and export via save dialog.
composeApp/src/wasmJsMain/kotlin/io/github/smiling_pixel/util/Logger.wasmJs.kt Wasm/JS logger implementation with console output and unsupported export/clear behavior.
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/preference/SettingsRepository.kt Adds log-level and persistence settings to the shared settings interface.
composeApp/src/nonWebMain/kotlin/io/github/smiling_pixel/preference/DataStoreSettingsRepository.kt Persists log settings for non-web platforms via DataStore.
composeApp/src/wasmJsMain/kotlin/io/github/smiling_pixel/preference/SettingsRepository.wasmJs.kt Persists log settings for web via localStorage.
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/screens/SettingsScreen.kt Adds a Diagnostics section (log level, persistence toggle, export/clear actions).
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/App.kt Applies logger settings reactively at runtime from SettingsRepository flows.
composeApp/src/androidMain/AndroidManifest.xml Adds FileProvider for securely sharing exported log files.
composeApp/src/androidMain/res/xml/log_export_paths.xml Declares FileProvider paths for log export (cache log_exports/).
composeApp/src/androidMain/README.md Documents Android build/manifest requirements for log export.
composeApp/src/androidMain/kotlin/io/github/smiling_pixel/sync/AutoSync.android.kt Switches AutoSync error logging to the new Logger API.
composeApp/src/jvmMain/kotlin/io/github/smiling_pixel/sync/AutoSync.jvm.kt Switches AutoSync error logging to the new Logger API.
composeApp/build.gradle.kts Adds AndroidX Core KTX dependency required for FileProvider integration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread composeApp/src/wasmJsMain/kotlin/io/github/smiling_pixel/util/Logger.wasmJs.kt Outdated
@SmilingPixel
SmilingPixel requested a review from Copilot June 28, 2026 01:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@SmilingPixel
SmilingPixel merged commit 853fee1 into main Jun 29, 2026
3 checks passed
@SmilingPixel
SmilingPixel deleted the feat/logging_system_0610 branch June 29, 2026 01:58
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