Logging API
From MoodleDocs
Overview
File locations
The Log API is all in lib/datalib.php and is automatically included for you during the page setup.
Functions and Examples
Functions
function add_to_log($courseid, $module, $action, $url=, $info=, $cm=0, $user=0) function user_accesstime_log($courseid=0) get_logs($select, array $params=null, $order='l.time DESC', $limitfrom=, $limitnum=, &$totalcount) function get_logs_usercourse($userid, $courseid, $coursestart) function get_logs_userday($userid, $courseid, $daystart)
Examples
Mod/*/db/log.php Files
Example
See Also
The Logging API allows you to add new entries to the Moodle log and define how they get displayed in reports.
(Ankit, please describe how the db/log.php files work too)