user context: make user context assignable through static call #1
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
setUserContext
method 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