Dispatch an Event when the a user logs

by Esnare Maussa   Last Updated April 30, 2018 08:07 AM

I was looking into the new Events system for Drupal 8 and there's something I haven't been able to figure out.

I need to dispatch an event when a user logs something to the watchdog table using the new logging API.

// Logs a notice
\Drupal::logger('system')->notice($message);
// Logs an error
\Drupal::logger('system')->error($message);

https://www.drupal.org/docs/8/api/logging-api/overview

I already define a new Event in a custom module but I don't know what needs to be created so when a module logs/adds information to the watchdog table using the code above my event gets triggered.

Thanks



Related Questions


Caching Event Subcriber

Updated March 13, 2016 08:03 AM

How can an event subscriber have access to entity type?

Updated November 17, 2017 23:07 PM



Event Subscriber Drupal8

Updated January 11, 2019 06:07 AM