orm
orm copied to clipboard
[FEATURE] Add Laravel event QueryExecuted support (Sentry support)
Changes proposed in this pull request:
- Laravel standard event support - QueryExecuted
- supports Sentry (Sentry bind QueryExecuted event)
I would do it more cleanly without public properties and with DI for EventDispatcher mocking ability: https://gist.github.com/rosamarsky/18a6ed0786179c39e8eb3cc6d3ae953a There is also need to make full filled Illuminate Connection from Dbal Connection before pass it into event.
But this feature is not a Logger. You are dispatching an event, which means that Illuminate Query has been executed and some applications and packages handle this event, and in some cases this can be fatal. So, IMHO, this feature makes sense, but this is not a logger. You can use the Sentry SDK to create a some SentryLogger and send queries through it...
@rosamarsky Thank you for your proposal. I used them.
I know it is not a Logger. But I think it fits there. It is optional developers can enable it optionaly. Implement this like a standard event is better because it could support more libraries, solutions... So it solve Sentry SDK support (error tracing and performance monitoring) and it could support Laravel Telescope etc.