-
Notifications
You must be signed in to change notification settings - Fork 2
Ability to add user info when logging (overrides or adds info if there isn't any) #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 adds the ability to override or supplement user information when logging client events. It allows callers to specify custom user ID, first name, and last name that will take precedence over session-based user information.
- Added optional user override parameters to the LogFunction type definition
- Modified logClientEvent to include overridden user info in the log payload
- Bumped package version from 4.1.7 to 4.1.8
Reviewed Changes
Copilot reviewed 3 out of 11 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/types/LogFunction.ts | Added optional userId, userFirstName, and userLastName parameters to LogFunction type |
| src/helpers/logClientEvent.tsx | Added overriddenUserInfo object to log payload containing the override parameters |
| package.json | Version bump to reflect the new feature |
| ? (opts as any).action | ||
| : undefined | ||
| ), | ||
| overriddenUserInfo: { |
Copilot
AI
Aug 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overriddenUserInfo object is always created even when all override values are undefined. Consider only including this object when at least one override value is provided to avoid unnecessary data in logs.
| }, | ||
| // Log level (default is info) | ||
| level?: LogLevel, | ||
| // Optional Canvas userId that overrides the current userId from the session (if there is one) |
Copilot
AI
Aug 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment mentions 'Canvas userId' which appears to be domain-specific. Consider using more generic terminology like 'user ID' to make the API more reusable across different contexts.
| // Optional Canvas userId that overrides the current userId from the session (if there is one) | |
| // Optional user ID that overrides the current user ID from the session (if there is one) |
karendolan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
No description provided.