Ability to add user info when logging (overrides or adds info if there isn't any)#42
Ability to add user info when logging (overrides or adds info if there isn't any)#42gabeabrams wants to merge 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
[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) |
No description provided.