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
MDL-43661 use new edulevel in all existing events
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
MDL-34055 add bulk DB->insert_records() method
MDL-43759 logging: Add helper traits for stores and add support for buffering
MDL-43759 logging: Update stores to remove duplicated code
MDL-43884 database: Fix get_tables() api for external stores
MDL-39933 logging: Add a external database store