'Recent log entries in MongoDB', 'description' => 'View events that have recently been logged in MongoDB.', 'type' => MENU_LOCAL_TASK, 'page callback' => 'drupal_get_form', 'page arguments' => array('mongodb_watchdog_overview'), 'access arguments' => array('access site reports'), 'file' => 'mongodb_watchdog.admin.inc', ); $items['admin/reports/settings/mongodb'] = array( 'title' => 'MongoDB logging settings', 'description' => 'MongoDB log settings', 'type' => MENU_LOCAL_TASK, 'page callback' => 'drupal_get_form', 'page arguments' => array('mongodb_watchdog_access_logging_settings'), 'access arguments' => array('administer site configuration'), 'file' => 'mongodb_watchdog.admin.inc', 'weight' => 4, ); return $items; } /** * Implement hook_menu_alter(). * * @param $items array */ function mongodb_watchdog_menu_alter(&$items) { $items['admin/reports/dblog/list'] = $items['admin/reports/dblog']; $items['admin/reports/dblog/list']['type'] = MENU_DEFAULT_LOCAL_TASK; $items['admin/reports/dblog/list']['title'] = 'Recent log entries in database'; if (array_key_exists('admin/reports/settings', $items)) { $items['admin/reports/settings/list'] = $items['admin/reports/settings']; $items['admin/reports/settings/list']['type'] = MENU_DEFAULT_LOCAL_TASK; $items['admin/reports/settings/list']['title'] = 'Database log settings'; } else { $items['admin/reports/settings/mongodb']['type'] = MENU_NORMAL_ITEM; } return $items; } /** * Implement hook_watchdog(). */ function mongodb_watchdog_watchdog(array $log_entry) { module_load_include('module', 'mongodb'); $collection = mongodb_collection(variable_get('mongodb_collectionname', 'watchdog')); $collection->insert((array) $log_entry); }