Tidy up standard entry-point boilerplate
Add Moodle 2.7 event logging support