User logging refactoring