rollbar / rollbar-php-symfony-bundle

Bundle for Symfony that integrates Rollbar tracker
MIT License
28 stars 25 forks source link

Possibility to use service as person_fn rather than a static function #93

Closed zinkovskiy closed 2 weeks ago

zinkovskiy commented 10 months ago

Description of the change

This PR allow to use service as person_fn

I created PersonProvider service that is used by default

To use custom person provider you need to define your own service with alias rollbar.person-provider in services.yml of your application, for example:

  rollbar.person-provider:
    class: App\Service\Rollbar\Provider\PersonProvider

No need to define person_fn option (thx to DI), the service will be used automatically, but if person_fn is defined, then it will be used

Logic of obtaining user info is not changed.

I've also discovered, that security.token_storage and serializer are private and cannot be obtained from container, so I passed it to Rollbar\Symfony\RollbarBundle\Factories\RollbarHandlerFactory constructor

Type of change

Related issues

Checklists

Development

Code review

I tested these changes on symfony 5.4 and symfony 6.4, it works well

@danielmorell could you please take a look on it?

zdavis-rollbar commented 8 months ago

@zinkovskiy, we are looking for a maintainer or owner of the repo. Would you like to participate?

zinkovskiy commented 7 months ago

@zinkovskiy, we are looking for a maintainer or owner of the repo. Would you like to participate?

Hi @zdavis-rollbar yes, I'm ready to maintain. contact me anytime when you have time, we are interested in keeping the project up to date

waltjones commented 7 months ago

@zinkovskiy Thank you for the PR. Please add tests for the new functionality, and run tests locally to ensure CI will pass.

zinkovskiy commented 7 months ago

@zinkovskiy Thank you for the PR. Please add tests for the new functionality, and run tests locally to ensure CI will pass.

Hi @waltjones, yes, I missed it. Now it's added Hope it helps to accept changes :slightly_smiling_face: