Skip to content

Conversation

@bjtitus
Copy link
Contributor

@bjtitus bjtitus commented Jan 7, 2026

Adds shared logging infrastructure for the widget extension to help with debugging:

  • Adds shared logging framework for widget extension debugging
  • Separates widget logs as a standalone upload file (similar to watch logs)
  • Uploads widget logs to a separate field in Zendesk

This enables better debugging of widget-related issues by capturing widget-specific logs in their own file.

To test

  • Run the app and install a widget on your homescreen
  • Interact with the widget
  • Export the database from Help & Feedback
  • Open the export directory
  • ✅ Verify that the widget logs are present
  • Submit a support ticket from Help & Feedback
  • ✅ Verify in Zendesk that the ticket contains the widget logs

Checklist

  • I have considered if this change warrants user-facing release notes and have added them to CHANGELOG.md if necessary.
  • I have considered adding unit tests for my changes.
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

@bjtitus bjtitus added Widgets Logging Additions to logging and debugging tooling labels Jan 7, 2026
@dangermattic
Copy link
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@bjtitus bjtitus force-pushed the bjtitus/widget-logging branch from 4ab0c57 to 6cd4904 Compare January 7, 2026 17:30
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.
@bjtitus bjtitus force-pushed the bjtitus/widget-logging branch from 6cd4904 to f272b2b Compare January 9, 2026 04:45
@bjtitus bjtitus changed the base branch from release/8.3 to trunk January 9, 2026 04:58
@bjtitus
Copy link
Contributor Author

bjtitus commented Jan 9, 2026

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

Do Not Merge Do Not Review Logging Additions to logging and debugging tooling Widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants