Function to detect any and all user input

I want to trace all UI events mouse movement button clicks, and more…

How?