sentry-php
sentry-php copied to clipboard
Add breadcrumb monolog handler
This is an interesting additional feature, that would be a required stepping stone for me to proceed with the strategy outlined in https://github.com/getsentry/sentry-symfony/issues/337#issuecomment-800920045.
This pull request has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
This should wait for #1275
This pull request has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Do you have plan to release this change?
It needs more work after #1321, I'll try to look at it now.
@Jean85 is there any way we can help on this PR , as this would remove for us the need of https://github.com/B-Galati/monolog-sentry-handler (as we use it to get log as breadcrumb )
This needs a rebase/remerge badly. I'll try it now.
@Jean85 Just some general thoughts/questions
- From what I gathered from the linked issue, this will primarily be used in the Symfony SDK. Would it suffice to add it only there?
- Do we need to add some docs to tell people how to wire it up on their application if they use monolog?
- the Symfony official integration would be the main immediate beneficiary of this feature, but since it's based on Monolog, it can be used/leveraged everywhere
- this may depend a lot on the application, since Monolog could be wired manually or baked into the app config (see Symfony, maybe Laravel too?)
I would ask @stayallive if the Laravel integration could benefit from this too, and/or if it could require dedicated documentation.
This could possibly also be used by Laravel, since Laravel also uses Monolog under the hood, so it would probably need some added info to the documentation on how to leverage this in a Laravel context.
Any updates about the doc to know how to set it up?
I'll write something up in the coming days 🙂 https://github.com/getsentry/sentry-docs/issues/5487
I'll write something up in the coming days slightly_smiling_face getsentry/sentry-docs#5487
Any update on this?
In short, do this:
services:
Sentry\Monolog\BreadcrumbHandler:
arguments:
- '@Sentry\State\HubInterface'
- !php/const Monolog\Logger::INFO
monolog:
handlers:
# this one acts like fingers_crossed
sentry_breadcrumbs:
type: service
name: sentry_breadcrumbs
id: Sentry\Monolog\BreadcrumbHandler
# this one is the main one, once it captures, the breadcrumbs collected by the first one are submitted too
sentry:
type: sentry
level: !php/const Monolog\Logger::ERROR
hub_id: Sentry\State\HubInterface