? 645978-dblog-features.patch
? mongodb_watchdog-capped.patch
? mongodb_watchdog-tests.patch
Index: mongodb_watchdog.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mongodb/mongodb_watchdog/mongodb_watchdog.admin.inc,v
retrieving revision 1.3
diff -u -p -r1.3 mongodb_watchdog.admin.inc
--- mongodb_watchdog.admin.inc	15 Dec 2009 01:32:05 -0000	1.3
+++ mongodb_watchdog.admin.inc	31 Dec 2009 19:55:49 -0000
@@ -260,3 +260,45 @@ function mongodb_watchdog_build_filter_q
   }
   return $find;
 }
+
+/**
+ * Settings for MongoDB watchdog.
+ */
+function mongodb_watchdog_settings() {
+  $form['mongodb_watchdog_size'] = array(
+    '#title' => t('Maximum size of the collection'),
+    '#type' => 'select',
+    '#default_value' => variable_get('mongodb_watchdog_size', 10000),
+    '#options' => array(0 => t('Unlimited')) + drupal_map_assoc(array(1000, 10000, 100000, 1000000, 10000000)),
+    '#description' => t('The maximum size of the collection in bytes.'),
+  );
+  $form['mongodb_watchdog_row_limit'] = array(
+    '#title' => t('MongoDB log entries to keep'),
+    '#type' => 'select',
+    '#default_value' => variable_get('mongodb_watchdog_row_limit', 1000),
+    '#options' => array(0 => t('All')) + drupal_map_assoc(array(100, 1000, 10000, 100000, 1000000)),
+    '#description' => t('The maximum number of entries to keep in the database log. Old entries will be droped. Select  Select 0 to keep all entries.'),
+  );
+
+  $form['#submit'][] = 'mongodb_watchdog_settings_submit';
+  return system_settings_form($form);
+}
+
+/**
+ * Submit handler for mongodb watchdog settings.
+ */
+function mongodb_watchdog_settings_submit(&$form, &$form_state) {
+  // if the row limit changed drop the old collection and setup a new with limited rows.
+  if (($form_state['values']['mongodb_watchdog_row_limit'] != variable_get('mongodb_watchdog_row_limit', 1000))
+    || ($form_state['values']['mongodb_watchdog_size'] != variable_get('mongodb_watchdog_size', 10000))) {
+    $collection = mongodb_collection(variable_get('mongodb_collectionname', 'watchdog'));
+    $collection->db->dropCollection($collection_name);
+    if ($form_state['values']['mongodb_watchdog_size'] && $form_state['values']['mongodb_watchdog_row_limit']) {
+      $collection->db->createCollection($collection_name, TRUE, $form_state['values']['mongodb_watchdog_size'], $form_state['values']['mongodb_watchdog_row_limit']);
+    }
+    else {
+      $collection->db->createCollection($collection_name);
+    }
+  }
+}
+
Index: mongodb_watchdog.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mongodb/mongodb_watchdog/mongodb_watchdog.info,v
retrieving revision 1.1
diff -u -p -r1.1 mongodb_watchdog.info
--- mongodb_watchdog.info	29 Nov 2009 22:42:13 -0000	1.1
+++ mongodb_watchdog.info	31 Dec 2009 19:55:49 -0000
@@ -1,5 +1,5 @@
 ;$Id: mongodb_watchdog.info,v 1.1 2009/11/29 22:42:13 dereine Exp $
-name = MongoDB watchdog
+name = MongoDB Watchdog
 description = 'A watchdog implementation using MongoDB'
 package = MongoDB
 version = VERSION
@@ -7,4 +7,5 @@ core = 7.x
 dependencies[] = mongodb
 files[] = mongodb_watchdog.module
 files[] = mongodb_watchdog.admin.inc
+files[] = mongodb_watchdog.test
 
Index: mongodb_watchdog.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mongodb/mongodb_watchdog/mongodb_watchdog.module,v
retrieving revision 1.2
diff -u -p -r1.2 mongodb_watchdog.module
--- mongodb_watchdog.module	14 Dec 2009 16:19:31 -0000	1.2
+++ mongodb_watchdog.module	31 Dec 2009 19:55:49 -0000
@@ -16,6 +16,14 @@ function mongodb_watchdog_menu() {
     'access arguments' => array('access site reports'),
     'file'  => 'mongodb_watchdog.admin.inc',
   );
+  $items['admin/config/development/mongodb_watchdog'] = array(
+    'title' => 'MongoDB Log Settings',
+    'description' => 'Change settings of the mongodb watchdog implementation.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('mongodb_watchdog_settings'),
+    'access arguments' => array('administer site configuration'),
+    'file' => 'mongodb_watchdog.admin.inc',
+  );
   return $items;
 }
 /**
