Yii2 logger of user activity

I would like to know the best way to record activities made ​​by the user more centralized and easily.

every action performed in the database must be entered in this log. which user performed the action ? If the action was insert, delete or update ? Primary key that references the action taken ? etc…

Any extension or tip on how to work with these logs ?

yes there is a great extension

yii2-audittrail

https://packagist.org/packages/sammaye/yii2-audittrail

It keep track of:

[list=1][]what has been done (insert, delete, update)[]on which record, in case of update it keep track also of value[]who made it[]and finally when[/list]

I used it in a couple of project and it does the work.

As side note: purge old audit periodically, the database can get huge easily.