Logging in jupyterhub

How can I log the Python commands/functions, along with the terminal commands run by users on spawned notebooks?

Have a read through this topic: