Move logging to event listener