Index: pifr.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/pifr.module,v
retrieving revision 1.40
diff -u -r1.40 pifr.module
--- pifr.module	4 Dec 2008 04:30:10 -0000	1.40
+++ pifr.module	5 Dec 2008 06:49:24 -0000
@@ -8,6 +8,11 @@
  */
 
 /**
+ * Control detailed debugging output through watchdog.
+ */
+define('PIFR_DEBUG', TRUE);
+
+/**
  * Server types.
  */
 define('PIFR_SERVER_PROJECT', 1);
@@ -695,3 +700,14 @@
       return 'Unknown';
   }
 }
+
+/**
+ * Output debug message via watchdog when enabled.
+ *
+ * @param string $message Debug message.
+ */
+function pifr_debug($message) {
+  if (PIFR_DEBUG) {
+    watchdog('pifr_debug', $message);
+  }
+}
Index: pifr.review.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/pifr.review.inc,v
retrieving revision 1.16
diff -u -r1.16 pifr.review.inc
--- pifr.review.inc	4 Nov 2008 06:33:19 -0000	1.16
+++ pifr.review.inc	5 Dec 2008 06:49:24 -0000
@@ -20,9 +20,13 @@
   variable_set('pifr_server', $server_url);
   variable_set('pifr_file_id', $file_id);
   variable_set('pifr_file', $filepath);
+  
+  pifr_debug('File information variables set.');
 
   // Run review in background so testing master server can close connection.
   pifr_review_exec_background('curl ' . url('pifr/review', array('absolute' => TRUE)));
+  
+  pifr_debug('Background process started.');
 }
 
 /**
@@ -31,8 +35,11 @@
 function pifr_review_run() {
   if (!variable_get('pifr_reviewing', FALSE)) {
     // Possible invalid attempt to run slave.
+    pifr_debug('Review halted, possible invalid attempt to run slave.');
     return;
   }
+  
+  pifr_debug('Starting file review.');
 
   $file_id = variable_get('pifr_file_id', '');
   $filepath = variable_get('pifr_file', '');
@@ -43,6 +50,8 @@
     pifr_review_send($file_id, PIFR_FILE_ERROR, 'Failed to fetch file.');
     return;
   }
+  
+  pifr_debug('File fetched.');
 
   // File downloaded, checkout latest CVS.
   if (!pifr_review_checkout()) {
@@ -50,6 +59,8 @@
     pifr_review_send($file_id, PIFR_FILE_ERROR, 'Failed to checkout HEAD.');
     return;
   }
+  
+  pifr_debug('CVS checkout complete.');
 
   // Apply patch to latest CVS.
   if (!pifr_review_apply_patch(basename($filepath))) {
@@ -57,6 +68,8 @@
     pifr_review_send($file_id, PIFR_FILE_TEST_FAIL, 'Failed to apply patch.');
     return;
   }
+  
+  pifr_debug('Patch applied.');
 
   // Check syntax of files changed by patch.
   if (!pifr_review_check_syntax(basename($filepath))) {
@@ -64,6 +77,8 @@
     pifr_review_send($file_id, PIFR_FILE_TEST_FAIL, 'Invalid PHP syntax.');
     return;
   }
+  
+  pifr_debug('PHP syntax checked.');
 
   // Install HEAD.
   if (!pifr_review_install()) {
@@ -71,6 +86,8 @@
     pifr_review_send($file_id, PIFR_FILE_TEST_FAIL, 'Failed to install HEAD.');
     return;
   }
+  
+  pifr_debug('HEAD installation complete.');
 
   // Run tests.
   if (!pifr_review_run_tests()) {
@@ -78,9 +95,13 @@
     pifr_review_send($file_id, PIFR_FILE_TEST_FAIL, 'Failed to run tests.');
     return;
   }
+  
+  pifr_debug('Testing completed.');
 
   // Send testing results as XML. Server will evaluate the PASS based on the summary XML.
   pifr_review_send($file_id, PIFR_FILE_TEST_PASS, '', $GLOBALS['pifr_xml_results']);
+  
+  pifr_debug('Results sent.');
 }
 
 /**
