Skip to content

feat(desktop): verbose logging toggle + Sentry/PostHog instrumentation expansion#1769

Draft
richiemcilroy wants to merge 2 commits intomainfrom
cursor/add-verbose-logging-setting-709b
Draft

feat(desktop): verbose logging toggle + Sentry/PostHog instrumentation expansion#1769
richiemcilroy wants to merge 2 commits intomainfrom
cursor/add-verbose-logging-setting-709b

Conversation

@richiemcilroy
Copy link
Copy Markdown
Member

@richiemcilroy richiemcilroy commented Apr 28, 2026

What

Two complementary changes that make support diagnoses dramatically easier:

1. Verbose logging toggle (General Settings → Diagnostics)

Adds a Diagnostics card to General Settings with three controls:

  • Verbose logging toggle — flips the global tracing_subscriber level filter to TRACE at runtime via a reload::Layer, so every span/event from the recording, rendering, export, and upload pipelines is captured to the rolling log file. Persisted across restarts in GeneralSettingsStore.
  • Reveal logs — opens the platform-native logs folder (~/Library/Logs/so.cap.desktop on macOS, %LOCALAPPDATA%/so.cap.desktop/logs on Windows) via tauri-plugin-opener.
  • Upload logs — co-locates the existing upload_logs flow next to the toggle so users can ship the captured trace logs in one click after reproducing.

Implemented via tracing_subscriber::reload::Layer<LevelFilter, _> in main.rs, a small VerboseLoggingHandle managed in Tauri state, and two new set_verbose_logging / open_logs_folder commands.

2. Always-on telemetry coverage (no toggle required)

So we don't always need users to flip the toggle and re-upload to diagnose issues, the Sentry/PostHog surface is now far richer by default:

  • sentry-tracing layer — every error!() event becomes a Sentry event, and every warn!() / info!() rides along as a breadcrumb. The desktop app already has hundreds of structured tracing calls across recording, encoder, muxer, upload, camera, mic, GPU, and editor flows; they now all flow into Sentry automatically with their fields and span context attached.
  • Sentry scope tags at startupos, arch, cap_version, instance_id, cap_backend (cloud vs self_hosted), verbose_logging state. This lets us filter issues per environment.
  • Export failure contextwith_scope adds export.format, export.fps, export.cursor_only, export.force_ffmpeg, and project_path to the captured Sentry message instead of just the bare error string.
  • GPU init failureswgpu::request_adapter / request_device errors that previously dropped silently via .ok()? are now logged with error! (adapter_name, adapter_backend, adapter_device_type, error) so they reach Sentry.
  • multipart_upload_failed PostHog event gains stage (video_join / instant_multipart / studio_segment), retried_chunk_count, and bytes_uploaded_mb so we can tell which upload path is breaking and how far it got.
  • recording_started PostHog event now sends real target_width / target_height derived from the capture target's display / area bounds (was hardcoded to 0).

Walkthrough

Manual UI testing was not run — this cloud agent is Linux, but the desktop crate (scap-targets, whisper-rs-sys, cidre, …) only builds on macOS / Windows. The Rust changes pass cargo check for sentry-tracing resolution and were carefully matched against existing patterns:

  • The new tracing → Sentry layer is the standard sentry::integrations::tracing::layer() with the recommended EventFilter mapping.
  • Scope tags reuse the same sentry::configure_scope block that already runs at startup.
  • Export tags are added via sentry::with_scope so they apply only to the captured failure.
  • request_device already returns Result<(Device, Queue), Error> in wgpu 25 (matches existing usage in screenshot_editor.rs).

The desktop CI matrix on macOS + Windows runners exercises the full clippy -D warnings gate.

Notes

  • Cargo.toml adds the tracing feature on sentry. Cargo.lock updated.
  • tauri.ts is regenerated by tauri-specta but tracked in this repo (see prior chore(desktop): regenerate tauri bindings ... commits). Updated by hand in lockstep with the new commands and GeneralSettingsStore field — the next debug run will produce the same output.
  • No behavioural change to upload retry logic or to the enable_telemetry opt-out: all PostHog events still respect the existing telemetry toggle, and Sentry is only initialised when CAP_DESKTOP_SENTRY_URL is set at compile time (release builds only, debug builds drop events via before_send).
Open in Web Open in Cursor 

cursoragent and others added 2 commits April 28, 2026 21:14
…eneral settings

Adds a Diagnostics section to General Settings that lets users opt
into trace-level logging at runtime via tracing-subscriber's reload
handle. Includes Reveal Logs and Upload Logs buttons, and persists
the preference so verbose logging is re-applied on startup.

Exposes set_verbose_logging and open_logs_folder Tauri commands.

Co-authored-by: Richie McIlroy <richiemcilroy@users.noreply.github.com>
- Add sentry-tracing layer so every error!()/warn!()/info!() call across
  the recording, encoding, upload, render and editor pipelines feeds
  Sentry as breadcrumbs (warn/info) and events (error) automatically.
- Tag the Sentry scope at startup with os, arch, cap_version,
  instance_id, cap_backend (cloud vs self_hosted) and the verbose
  logging state, so issues are filterable per environment.
- Capture export failures with format, fps, cursor_only, force_ffmpeg
  context and project path on the Sentry scope.
- Promote silent wgpu adapter / device init failures to error logs so
  GPU init issues now flow through Sentry.
- Extend MultipartUploadFailed PostHog event with stage, retry count
  and bytes uploaded, and use the recording's actual capture target
  resolution for RecordingStarted instead of zeros.

Co-authored-by: Richie McIlroy <richiemcilroy@users.noreply.github.com>
@cursor cursor Bot changed the title feat(desktop): verbose logging toggle in General settings feat(desktop): verbose logging toggle + Sentry/PostHog instrumentation expansion Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants