Added a feature for logging user accesses.

Still far from perfect. Needs reviews and a front-end counterpart.