Seldaek/monolog

How to access a handlers response?

rreynier opened this issue · 3 comments

I am currently using the Raven handler so that my exceptions go into Sentry. Upon capturing an Exception in Sentry, Sentry will respond with an ID. Before my current attempt at implementing Monolog, I would capture the exception in Sentry and then my error page would show the Sentry ID (if the Sentry call succeeded). Ex. "An error has occured. Please contact support and reference #[sentry-id]." The Monolog Raven handler doesn't seem to expose the Sentry Id in any sort of way. In fact the response of captureException() isn't actually captured.

Do you have any suggestion on how to go about exposing this somehow? I could extend the Raven handler an possible just store some sort of GLOBAL but that seems awful dirty.

Would love to hear your thoughts.

I guess the best is storing this id in the raven handler and then adding a public getLastExceptionId or whatever makes most sense (can you get an id to any msg or only exceptions?). That way your app can then fetch the id from the handler directly. Shouldn't be too hard to implement and it avoids globals :)

I believe both exceptions and messages provide you with a unique sentry id. Its extremely useful to be able to be pointed to the exact record in Sentry by support.

Anyway, I will investigate this approach tomorrow and report back on my implementation.

Thanks!

Closing as I don't think there is much to do here, but if you have any more to say feel free to add :)