user context: make user context assignable through static call#1
Open
hojgr wants to merge 1 commit intonofutur3:masterfrom
hojgr:master
Open
user context: make user context assignable through static call#1hojgr wants to merge 1 commit intonofutur3:masterfrom hojgr:master
hojgr wants to merge 1 commit intonofutur3:masterfrom
hojgr:master
Conversation
Owner
|
Hi Michal! |
Owner
|
@hojgr Is there any particular reason why you need to access user context by static call? I have implemented another solution (now in dev-master) but I am still testing the feature. |
Author
|
Yes. The reason is in first paragraphs of the issue. |
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.
Hi! Awesome package!
But while implementing Sentry to my application I found it unreasonably difficult to assign user context to Sentry client - I'd have to deal with replacing Logger myself which compared to just putting three lines do config and one to middleware/presenter is just too inconvenient.
I changed the
setUserContextmethod to be static and stored the instance to static variable to make it convenient. This is breaking change and will break every project that is extending the class or using it in a way not described in readme.I was considering naming the method some other name, but it just didn't sit right with me. It will not even be that big of a breaking change considering the library has only 24 downloads so far.
Also, I didn't update the readme yet beacuse I was not sure if you would be interested in this change. If you would be interesetd, I'll update readme to highlight the new usage.
Kind regards
Michal Hojgr