Skip to content

feat: integrate PostHog error tracking with logger#649

Merged
bokelley merged 1 commit into
mainfrom
bokelley/posthog-check
Jan 6, 2026
Merged

feat: integrate PostHog error tracking with logger#649
bokelley merged 1 commit into
mainfrom
bokelley/posthog-check

Conversation

@bokelley

@bokelley bokelley commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add error hook system to Pino logger that captures error/fatal logs
  • Create initPostHogErrorTracking() to connect logger to PostHog
  • Remove duplicate captureException call in global error handler (was capturing twice)
  • Add rate limiting (100ms) and deduplication (5s window) to prevent flooding
  • Use addEventListener instead of window.onerror to not overwrite existing handlers
  • Add try-catch around PostHog client initialization

How it works

All logger.error() calls are now automatically captured to PostHog with module context and stack traces when POSTHOG_API_KEY is configured. This means you'll see all server-side errors in PostHog without any additional instrumentation.

Test plan

  • TypeScript compiles
  • All 179 tests pass
  • Docker build works
  • PostHog initialization message appears in logs
  • PostHog config is injected into frontend HTML

🤖 Generated with Claude Code

- Add error hook system to Pino logger that captures error/fatal logs
- Create initPostHogErrorTracking() to connect logger to PostHog
- Remove duplicate captureException call in global error handler
- Add rate limiting (100ms) and deduplication (5s window) to prevent flooding
- Use addEventListener instead of window.onerror to not overwrite handlers
- Add try-catch around PostHog client initialization

All logger.error() calls are now automatically captured to PostHog
with module context and stack traces when POSTHOG_API_KEY is configured.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit a0a571c into main Jan 6, 2026
6 checks passed
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.

1 participant