feat(mobile): in-app debug logging with file export - #183
Merged
Conversation
Add a persistent ring-buffer logger (5000 entries, consecutive duplicates collapsed with a repeat counter) stored via expo-file-system on native and localStorage on web. Error-level entries are flushed immediately so they survive crashes. Instrumented central choke points so most activity is captured without per-screen work: every API request (method, path, status, duration), every screen change and shell gate, every button/toggle/row/segment interaction through the core UI components, global JS errors, session lifecycle, auth callback outcomes and the push registration flow. Tokens, request bodies and text-input values are never logged. Settings gains a Support section to export the logs as a .txt file through the native share sheet (expo-sharing, with a text-share fallback and a web download) and to clear them.
abarghoud
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
User-reported issues (like the recent Android push-activation reports) are hard to diagnose without visibility into what happened on the device. This adds an in-app debug log that users can export and attach to a bug report.
What
Logger (
core/logging/)appLoggersingleton withinfo/warn/error(tag, message, data?).GET /alerts → 200 | 91ms (×3)), so the 30s alerts poll no longer eats the buffer. Attached data is truncated at 300 chars.expo-file-systemon native,localStorageon web. Error-level entries are flushed immediately so they survive a crash.What gets captured (central choke points, no per-screen wiring)
GlassButton,AppSwitch,ListRow,SegmentedControl).ErrorUtilslogs fatal/non-fatal errors (name, message, stack head) before delegating to the previous handler.Export UI (Settings → Support)
sentryguard-logs-<date>.txtand opens the native share sheet viaexpo-sharing(falls back to a plain-text share if unavailable; downloads the file on web).Dependencies
expo-file-system ~19.0.23— already shipped in every build (dependency of theexpopackage), now declared directly. No native rebuild needed for it.expo-sharing ~14.0.8— new native module: works in Expo Go now, standalone builds need the next native build (until then the text-share fallback applies).yarn install --immutableverified.Tests
nx typecheck mobile, lint andnx export mobileall pass.Notes
settings.helpers.ts, locales) — trivial to resolve whichever lands first.