Changing logging to emit events instead