Hooks: how to catch the user that logs out

Hi,

I am using hooks to catch several events and would like to catch the user that logs out. In the post_login hook, you get directly the UID in the $params array. Trying the same using the logout hook doesn’t seem to work, kind of expected since logout() doesn’t take any arguments. How could this be done using the logout() hook? If not possible, any workarounds?

Thanks!
K.

The solution was pretty simple, you can get the current user by adding
use OC\User;
and then calling getUser() in the code that handles the logout event like this:
$user = \OC_User::getUser();