<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [];
/**
* Register any events for your application.
*/
public function boot(): void
{
parent::boot();
// Listen for all events and log them
Event::listen('*', function ($eventName, array $data) {
if (in_array($eventName, [
// List all events you want to ignore here
'Illuminate\Log\Events\MessageLogged',
])) {
return;
}
\Log::info("Event dispatched: {$eventName}");
// Or, if you want to log the data as well
// \Log::info("Event dispatched: {$eventName}", $data);
});
}
}