Skip to content

[Feature] Add centralized Sentry logger for main/renderer with PII scrubbing - #617

Closed
Power-Maverick with Copilot wants to merge 1 commit into
devfrom
copilot/feature-centralized-logging
Closed

[Feature] Add centralized Sentry logger for main/renderer with PII scrubbing#617
Power-Maverick with Copilot wants to merge 1 commit into
devfrom
copilot/feature-centralized-logging

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Introduces a centralized app-level logging foundation using Sentry across Electron main and renderer, replacing fragmented ad-hoc logging paths with a consistent warning/error pipeline. The implementation is structured to support app-owned log visibility and future tool-level routing without embedding log UI logic inside individual tools.

Type of change

  • New feature
  • Bug fix
  • Refactor (no functional change)
  • Documentation
  • Chore / maintenance (dependency update, build, config)
  • Test addition / improvement

Changes

  • Central logger module

    • Added a single shared logging surface for warnings/errors (message + exception paths), with context support and source tagging.
    • Consolidated Sentry-facing behavior (level filtering, normalization, enrichment) into one place to keep future maintenance low-friction.
  • Sentry initialization in both processes

    • Wired Sentry bootstrap for main and renderer process entry paths.
    • Ensured both processes use the same centralized logger contract and scrubbing policy.
  • PII scrubbing and payload hardening

    • Added event-level scrubbing before send to remove/neutralize sensitive fields.
    • Constrained telemetry scope to required operational metadata (e.g., install/runtime diagnostics) and warning/error events only.
  • Unhandled error capture

    • Registered global handlers for unhandled exceptions and unhandled promise rejections in main and renderer.
    • Routed global fault capture through the centralized logger/Sentry path for consistency.
  • Code path alignment

    • Updated affected warning/error call sites to use the centralized logger rather than direct process-local logging patterns.
  • Forward path for centralized app log UX

    • Kept logging ownership at app level so tool logs can flow through the same interface/API, enabling settings-driven log area visibility and source-based filtering in follow-up UI work.
// Example usage pattern
logger.warn("Tool metadata fetch degraded", {
    source: "tool-registry",
    toolId,
    correlationId,
});

logger.error("Unhandled renderer exception", error, {
    source: "renderer",
    view: "marketplace",
});

Architecture checklist

Packages (types & validation)

  • Not applicable — no changes to packages/

If you did change a package:

  • @pptb/types (types): type definitions updated and version bumped in packages/types/package.json
  • @pptb/validate (validation): validation rules updated and version bumped in packages/validation/package.json

Code quality

  • pnpm run typecheck passes with 0 errors (warnings are acceptable)
  • pnpm run lint passes with 0 errors (warnings are acceptable)
  • pnpm run build completes successfully

Testing

  • pnpm run test:unit passes (for changes to src/main/, src/common/, or src/renderer/ utilities)
  • pnpm run test:e2e passes (for UI / navigation / end-to-end flows)
  • Manually tested in the running app (pnpm run dev)

Scenario tested:

Verified main and renderer warning/error paths route through centralized logger; validated global unhandled exception/rejection capture; confirmed scrubbing hook runs before send and no info/debug noise is emitted.

Screenshots / recordings

N/A (foundational telemetry/logging infrastructure change; no direct UI delta in this PR).

Breaking changes

  • No breaking changes
  • Yes — describe impact and migration path below:

Reviewer notes

  • I have added appropriate unit and/or e2e tests for this change
  • I have resolved all GitHub Copilot review comments
  • I have followed the guidelines in CONTRIBUTING.md

Copilot AI linked an issue Aug 5, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Implement centralized logging using Sentry for Electron [Feature] Add centralized Sentry logger for main/renderer with PII scrubbing Aug 5, 2026
Copilot AI requested a review from Power-Maverick August 5, 2026 22:59
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.

[Feature]: Centralized Logging

2 participants