pbergman / sentry-bundle
Monolog sentry handler with support for breadcrumbs and sentry dispatching events
Installs: 1 154
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.4.0
- monolog/monolog: ^1.3
- sentry/sentry-symfony: ^4.2
README
I have created this bundle because the entry/sentry-symfony was not using the batch handler from monolog when connected with a buffer handler. This resulted in all messaged from a request being delivered individually instead of using breadcrumbs.
So with this extension you could configure monolog like this:
handlers:
main:
type: fingers_crossed
action_level: error
handler: grouped
excluded_http_codes: [404, 405]
grouped:
type: whatfailuregroup
members: [ streamed, sentry_deduplicated ]
streamed:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
sentry_deduplicated:
type: deduplication
handler: sentry
sentry:
type: service
id: pbergman.sentry_handler
And when the fingercrossed handler get an error message, all messages in the buffer of INFO or higher will be grouped and send to sentry.
This bundle has also created a bridge between the native hooks (before_breadcrumb an before_send) and symfony dispatcher. So now you can just create listener that listens to PBergman\Bundle\SentryBundle\Events::EVENT_BEFORE_SEND
or PBergman\Bundle\SentryBundle\Events::EVENT_BEFORE_BREADCRUMB
By default it will create a listener that will filter exception classes (see bin/console config:dump-reference p_bergman_sentry
) to disable add the following config:
p_bergman_sentry:
excluded_exceptions: ~
Or set there the desired classes.