Improved the output of course logs by querying Moodle database

additional class variable added $courseId in the locallib, code comments added in doxygen format as per moodle standards