Event Triggers will be fired whenever event associated with them occurs in database.
Please use below link for complete overview of Event Triggers in PostgreSQL
Logging DDL Command Start Events
This is example for creating an Event Trigger and logging
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0