There is a global variable called "$current_user".
global $current_user;
And in there is a field called "user_login".
$current_user->user_login;
You can also use "$current_user->id" to get the user id.
Mainly notes to future-Twig (and for anyone else who may find them useful)
If you've found one or more of my blog posts helpful, why not say thanks by buying me a coffee or beer?
There is a global variable called "$current_user".
global $current_user;
And in there is a field called "user_login".
$current_user->user_login;
You can also use "$current_user->id" to get the user id.