Wire the app's connectivity log into a real Settings screen - #262
Merged
Merged
Conversation
Settings → Advanced's "View Connectivity Logs" row actually opened qBittorrent's own server-side log viewer, which requires a live connection and shows nothing on the failure the user is trying to diagnose. Repurpose LogViewer to display services/connectivity-log.ts (the app's own in-memory HTTP/auth/connection trail, already captured but never surfaced) instead, add a Copy action, and rename the old row to "Server Logs" since it's a legitimate separate feature, just mislabeled. Delete services/log-storage.ts, which nothing populated.
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.
Summary
Settings → Advanced's "View Connectivity Logs" row was mislabeled — it opened
app/(tabs)/logs.tsx, which is actually qBittorrent's own server-side application/peer log viewer (logs/main,logs/peers). That screen explicitly shows a "not connected" placeholder whenever the app isn't connected — exactly the moment a user needs a connectivity diagnostic. This came up in issue #256, where a user was pointed at "View Connectivity Logs" to diagnose a connection failure and got a dead end.The app already captures a real HTTP/auth/connection diagnostic trail in
services/connectivity-log.ts(an in-memory ring buffer fed byclogDebug/Info/Warn/Errorcalls throughoutservices/api/client.ts,services/server-manager.ts,context/ServerContext.tsx, etc.), but it was never wired to any screen — only ever shown buried insideSuperDebugPanel's "Run Full Diagnostic".components/LogViewer.tsxto read fromservices/connectivity-log.tsinstead of the deadservices/log-storage.ts. Fixed the timestamp conversion (connectivity log usesDate.now()ms, the old code multiplied by 1000 assuming epoch-seconds), mappedDEBUG/INFO/WARN/ERRORlevels to theme colors, added each entry'stag(e.g.AUTH,HTTP,CONN) for context, and added a Copy action (expo-clipboard, mirroringapp/server/[id].tsx'scopyDebugInfopattern) that copiesformatConnectivityLog()'s output.viewServerLogs) since it's a legitimate separate feature, just mislabeled — still opensapp/(tabs)/logs.tsx. Added a new "View Connectivity Logs" row (new i18n keyviewConnectivityLogs) that opens the repurposedLogViewermodal directly, no live connection required. All six locales actually translated.services/log-storage.ts,tests/services/log-storage.test.ts, and the no-oplogStorage.autoDeleteIfNeeded()call inapp/_layout.tsx—logStorage.storeLogs()was never called anywhere, so nothing ever populated it.tests/rn/components/LogViewer.test.tsx(none existed before) covering rendering, empty state, Clear, and Copy (success + failure toast).app/(tabs)/logs.tsxFile Index entry (it isn't "connectivity logs"), updated theLogViewerandconnectivity-log.tsentries, and added a §10 Gotcha explaining the mislabeling for future sessions.Related to #256 (does not close it — this fixes a support tool discovered while investigating that issue, not the underlying TLS-rejection diagnosis work).
Test plan
npx tsc --noEmit— exit 0npm test— 1160 passed, 80 suites (includes newLogViewer.test.tsxand the locale parity suite)npm run lint— 0 errors, 38 warnings (baseline was 37; the +1 is the same pre-existingreact-hooks/set-state-in-effectpattern already present inCategoryModal.tsx/SavePathPickerModal.tsx, not a new class of issue)npm run format— clean, no additional changes🤖 Generated with Claude Code