bugsnag / bugsnag-symfony

BugSnag notifier for the Symfony PHP framework. Monitor and report errors in your Symfony apps.
https://docs.bugsnag.com/platforms/php/symfony
MIT License
43 stars 21 forks source link

Allow setting project root and strip path as regexes #109

Closed imjoehaines closed 4 years ago

imjoehaines commented 4 years ago

Goal

Recently we made a change to the Laravel notifier to expose the setStripPathRegex and setProjectRootRegex configuration options in the bugsnag-laravel config file — see https://github.com/bugsnag/bugsnag-laravel/pull/398

This PR adds the same configuration options to Symfony, which can be set like so:

bugsnag:
    strip_path_regex: '/^some regex$/'
    project_root_regex: '/^some other regex$/'

These options take precedence over the existing strip_path and project_root options. For example, if both strip_path and strip_path_regex are set, strip_path_regex will be used and strip_path will be ignored

Tests

The tests for this are mostly copied from the Laravel tests with the small change of using src rather than app for the default project root (which is used if neither project root configuration option is given)

Review

For the submitter, initial self-review:

For the pull request reviewer(s), this changeset has been reviewed for: