When should I log a meal, drink or activity; before or after I do it?

Log the activity as you start doing it.

Ideally, your timeline will have the entry of whatever you're doing at the start. 

You can drag the timeline back a bit if you've forgotten, but don't just wait to enter everything in batches.