-
Notifications
You must be signed in to change notification settings - Fork 166
Widget logging #3856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
bjtitus
wants to merge
2
commits into
trunk
Choose a base branch
from
bjtitus/widget-logging
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Widget logging #3856
+212
−4
Conversation
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
Collaborator
Generated by 🚫 Danger |
4ab0c57 to
6cd4904
Compare
Widget extension logs were previously invisible, making it difficult to debug issues with widget playback. This adds a shared logging system that writes widget logs to the App Group container, making them accessible from the main app. Changes: 1. LogFilePaths.swift: - Added sharedLogDirectory using App Group container - Added widgetLogFilePath for widget-specific logs - Automatically creates Logs directory in shared container 2. WidgetLog.swift (NEW): - Dedicated logger for widget extensions - Writes to shared App Group container - Includes log rotation (max 500KB) - Logs to both file and OS logger for debugging - Provides readLog() for main app access 3. FileLog.swift: - Updated loadLogFileAsString() to include widget logs - Widget logs appear in debug uploads with clear separator - Maintains backward compatibility 4. AppPlayEpisodeIntentExtension.swift: - Added WidgetLog calls throughout intent execution - Logs: episode UUID, play/pause actions, errors - Logs background task lifecycle 5. PlaybackManager.swift: - Added WidgetLog to preloadCurrentEpisode() - Enables tracking of preload behavior from widgets Benefits: - Widget interactions now fully traceable - Helps debug "first tap not responding" issues - Logs persist across app/widget launches - Included in support uploads automatically - OS logger provides real-time Console.app debugging Usage: 1. Widget logs: Console.app filter: subsystem:au.com.shiftyjelly.pocketcasts.widget 2. Main app access: WidgetLog.shared.readLog() 3. Debug uploads: Automatically included in FileLog Example log output: [2024-01-15T10:30:00Z] [WIDGET] PlayEpisodeIntent called for episode abc-123 [2024-01-15T10:30:00Z] [WIDGET] Toggling playback: play [2024-01-15T10:30:00Z] [WIDGET] PlaybackManager: Preloading episode Test Episode [2024-01-15T10:30:01Z] [WIDGET] Widget intent completed, ending background task
Widget logs should be uploaded as a separate file, not merged into the main debug log. This follows the same pattern as watch logs for better organization and clearer debugging. Changes: 1. FileLog.swift: - Removed widget log merging from loadLogFileAsString() - Widget logs no longer appear in main debug log - Keeps main and backup logs separate 2. LogFilePaths.swift: - Added widgetUploadLog path (uploadWidgetDebug.log) - Follows same naming convention as watchUploadLog 3. WidgetLog.swift: - Added logFileForUpload() method - Creates standalone upload file from widget logs - Merges current and backup widget logs for upload 4. FileLog+FileUpload.swift: - Added widgetLogFileForUpload() method - Added encryptedWidgetLogUUID() for uploads - Updated shouldUploadLogFiles to check widget logs - Widget logs uploaded separately like watch logs 5. SupportConfig.swift: - Added widgetLog custom field (ID: 360_049_192_092) - Added widgetLog(forDisplay:) method - Widget logs appear in support UI alongside watch logs - Reordered display: Debug(5), Watch(4), Widget(3), Podcasts(2), Meta(1) Benefits: - Widget logs are separate files in support tickets - Easier to identify widget-specific issues - Matches existing watch log pattern - Cleaner organization of debug data - Widget logs can be downloaded independently Upload structure: - uploadDebug.log (main app logs) - uploadWatchDebug.log (watch extension logs) - uploadWidgetDebug.log (widget extension logs) ← NEW All three files are encrypted and uploaded to Zendesk as separate attachments with appropriate custom field IDs.
6cd4904 to
f272b2b
Compare
Contributor
Author
|
This is paused waiting on a request to add the custom field for these logs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Adds shared logging infrastructure for the widget extension to help with debugging:
This enables better debugging of widget-related issues by capturing widget-specific logs in their own file.
To test
Checklist
CHANGELOG.mdif necessary.