Add logging in and out functionality