Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Thank you for following the naming conventions! 🙏 |
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces a comprehensive user identity tracking system for the evlog client logging framework, enabling automatic association of logs with user information across the entire stack.
Changes:
- Added
setIdentity()andclearIdentity()functions for client-side identity context management - Updated PostHog adapter to automatically map
event.userIdto PostHog'sdistinct_idfield with a proper fallback chain - Added comprehensive test coverage for identity tracking and PostHog userId mapping
- Enhanced documentation with identity usage examples and PostHog integration details
- Added interactive playground demos for identity feature testing
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/evlog/src/runtime/client/log.ts |
Core implementation of identity context with setIdentity() and clearIdentity() functions, spreads identity fields into all emitted logs |
packages/evlog/src/adapters/posthog.ts |
Updated distinct_id mapping to use fallback chain: config.distinctId → event.userId (if string) → event.service |
packages/evlog/src/nuxt/module.ts |
Added auto-imports for setIdentity and clearIdentity functions |
packages/evlog/test/identity.test.ts |
Comprehensive test suite covering identity setting, clearing, overrides, tagged logs, multiple fields, and replacement behavior |
packages/evlog/test/adapters/posthog.test.ts |
Added tests for userId-to-distinct_id mapping, priority handling, and non-string userId fallback |
apps/playground/app/pages/index.vue |
Added interactive handlers for testing identity set, log, override, and clear operations |
apps/playground/app/config/tests.config.ts |
Added Identity test section with four interactive test cases demonstrating identity features |
apps/docs/content/3.adapters/4.posthog.md |
Updated PostHog documentation to explain distinct_id fallback chain and automatic userId mapping |
apps/docs/content/1.getting-started/2.installation.md |
Added Client Identity section with usage examples and auth middleware integration pattern |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a user identity context to the client logging system, allowing you to associate logs with user information (such as
userIdandorgId) across the client, server, and external drains like PostHog. It also updates documentation, playground tests, and the PostHog adapter to support and demonstrate this new identity feature. The changes ensure that identity fields are automatically included in all client logs, can be overridden per event, and are correctly mapped to analytics drains.