MDL-43736 Events: event->contextinstanceid should be used where possible

While restoring event context might not be present (deleted)
So before using context api's check context or use event properties
Merge branch 'w03_MDL-43661_m27_edulevel', remote-tracking branch 'remotes/xrajesh/wip-mdl-43736' into logmaster
MDL-37658 add new logging API with basic implemenation
MDL-37658 logging: fixed bug in legacy logging
MDL-41266 move reader access control out from manager

We need to let reports decide if they want to use capability to access readers.
MDL-41266 logging: Legacy reader should convert passed courseid to course in sql queries
MDL-37658 logging: convert all standard log fields to legacy log fields