MDL-39846 implement new event dispatching and base event class
MDL-39846 sample conversion of role assignment events
MDL-39846 convert enrol_category to new events and class loader
MDL-39846 more fixing and cleanup of new events

* fix typos (thanks Rajesh)
* move log related data out from event API specification
* change callable key in definition to callback
* use event data in observers instead of cached records if possible
* event level is now a number 1…100
* improved event safety checks
* add event name and description method
* new can_view() method
* improve unit tests to test all callable types
* improved performance
MDL-39846 protect event dispatching process
MDL-39846 add logging TODOs
MDL-39846 add more magic and improve tests
MDL-39846 rename 'extra' event property to 'other'
MDL-39846 use word 'extra' for special log fields
Add cohort_created event
Add cohort updated event
Add cohort deleted event
Use the new events in library functions.

HACK HACK HACK - userid and contextid are not validated