Skip to content

Conversation

@NullPointerDepressiveDisorder
Copy link
Owner

This pull request introduces a unified logging system via the new Log enum, replacing scattered print/debug statements and custom file logging with structured logs sent to both the system log (os_log) and Sentry breadcrumbs/events. This improves observability, error tracking, and debugging across the app. The logging system is now used throughout the codebase, especially in app lifecycle, device monitoring, analytics, and launch-at-login management.

Unified Logging Implementation

  • Added the Log enum in AnalyticsManager.swift, providing methods for debug, info, warning, error, and fatal logs, all of which write to os_log and Sentry as appropriate.

Logging Integration Across the App

  • Replaced print statements and custom file logging in DeviceMonitor.swift with Log calls, including device startup, errors, and touch callback debug logs. Removed the old debug file logger. [1] [2] [3] [4]
  • Updated AppDelegate.swift to log major lifecycle events and state changes, such as startup, preferences loading, multitouch manager initialization, accessibility permission status, and termination. [1] [2] [3] [4] [5]
  • Replaced print statements in AnalyticsManager.swift with structured debug/info/warning logs, including initialization, event tracking, and error reporting. [1] [2] [3] [4] [5]
  • Updated LaunchAtLoginManager.swift to use Log for status and error reporting when enabling/disabling launch at login, including legacy macOS warnings.

Other Logging Improvements

  • Replaced a print warning in MultitouchManager.swift with a Log.warning when the event tap cannot be created.

- Add Log enum that writes to both os_log and Sentry
- Support for debug/info/warning/error/fatal levels
- Categories: app, device, gesture, analytics
- Debug logs only appear in debug builds
- Info/warning add Sentry breadcrumbs for crash context
- Error/fatal also capture as Sentry events
- Replace print() statements with Log calls in AnalyticsManager
- Remove custom file-based logging implementation
- Use Log.debug for touch callbacks (device category)
- Use Log.info for device start/stop lifecycle
- Use Log.warning when device list is nil
- Use Log.error when no multitouch device found
- Reduce log frequency (every 500 touches vs 100)
- Log app start, initialization steps, and termination
- Log accessibility permission status
- Log preferences loading and updates
- Provides breadcrumb trail for crash reports
- Log success/failure of launch at login configuration
- Use Log.error with error context for failures
- Log warning for unsupported macOS versions
Copy link
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

This PR introduces a unified logging system that replaces scattered print statements and custom file-based logging with a structured Log enum that writes to both Apple's os_log and Sentry for improved observability and error tracking.

  • Adds a new Log enum with five severity levels (debug, info, warning, error, fatal) that integrates with both os_log and Sentry breadcrumbs/events
  • Removes the old file-based debug logger from DeviceMonitor and replaces all print statements with structured log calls
  • Adds comprehensive logging to key application lifecycle events, device monitoring, analytics, and launch-at-login management

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
MiddleDrag/Utilities/AnalyticsManager.swift Implements the new Log enum with os_log and Sentry integration; updates existing print statements to use Log.debug() and Log.warning()
MiddleDrag/Utilities/LaunchAtLoginManager.swift Adds Log.info() for successful configuration and Log.error()/Log.warning() for failures and legacy macOS versions
MiddleDrag/Managers/MultitouchManager.swift Replaces event tap creation warning with Log.warning()
MiddleDrag/Managers/DeviceMonitor.swift Removes file-based debug logging; adds structured logs for device discovery, initialization, errors, and touch callbacks (sparsely logged for performance)
MiddleDrag/AppDelegate.swift Adds comprehensive logging throughout app lifecycle including startup, preferences, multitouch manager initialization, accessibility permissions, and termination

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Karan Mohindroo <96403086+NullPointerDepressiveDisorder@users.noreply.github.com>
Copy link
Contributor

Copilot AI commented Dec 4, 2025

@NullPointerDepressiveDisorder I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits December 4, 2025 04:05
Co-authored-by: NullPointerDepressiveDisorder <96403086+NullPointerDepressiveDisorder@users.noreply.github.com>
…pr-4

Fix double registration of default multitouch device
@NullPointerDepressiveDisorder NullPointerDepressiveDisorder merged commit 27c24df into main Dec 4, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants