Skip to content

chore: Add LogSaver logic#2011

Merged
solrubado merged 13 commits intomainfrom
feat-share-debug-logs
Apr 21, 2026
Merged

chore: Add LogSaver logic#2011
solrubado merged 13 commits intomainfrom
feat-share-debug-logs

Conversation

@sirambd
Copy link
Copy Markdown
Member

@sirambd sirambd commented Apr 21, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new utility (LogSaver) to persist app logcat output into a cache file and provide a cleanup method, likely to support debugging/support flows within the Android app.

Changes:

  • Introduces LogSaver with saveLogsToFile() to run logcat and write output to cacheDir/logs/kDrive_logs.txt.
  • Adds deleteLogs() to remove the cached logs directory.
  • Implements an internal InputStream helper to write stream content into the log file with cancellation checks.

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

Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt
Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt
Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

PR Reviewer Guide 🔍

(Review updated until commit 40bc864)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 Security concerns

Potential sensitive information exposure:
The implementation captures logcat output from the current process which may contain sensitive user data, authentication tokens, or personally identifiable information. While the file is stored in private app storage (cacheDir), if this feature enables user-initiated sharing of debug logs (implied by branch name feat-share-debug-logs), there is a risk of inadvertent data exposure. Consider sanitizing logs to remove patterns matching tokens/PII or warning users about sensitive content before sharing.

⚡ Recommended focus areas for review

Compilation Error

The deleteLogs() function uses incorrect syntax Dispatchers.IO { ... } instead of withContext(Dispatchers.IO) { ... }. This will cause a compilation error because Dispatchers.IO is a CoroutineDispatcher object, not a function that accepts a lambda block.

suspend fun deleteLogs() = Dispatchers.IO {
    if (logsDir.exists()) logsDir.deleteRecursively()
}
Sensitive Data Exposure

The logcat command captures all process logs which may contain sensitive information (authentication tokens, user PII, or internal system details). If this feature is intended for user-initiated log sharing (as suggested by the branch name), users might inadvertently expose private data when sharing the file. Consider implementing log sanitization filters or displaying a warning about potentially sensitive content before sharing.

val process = ProcessBuilder("logcat", "-d", "--pid=${android.os.Process.myPid()}")

Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt Outdated
@solrubado solrubado enabled auto-merge April 21, 2026 14:44
@github-actions
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 7b41bcf

@github-actions
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 6c29a78

Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt
Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/utils/LogSaver.kt
@github-actions
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 40bc864

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

@solrubado solrubado merged commit 1dd8eb8 into main Apr 21, 2026
8 checks passed
@solrubado solrubado deleted the feat-share-debug-logs branch April 21, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants