Current best way to get logged in customer id

You just have to enable in settings/checkout you can chose to make accounts optiona lor mandatory, default is disabled