Forráskód Böngészése

Issue #72: Updating API to include 2.1 improvements: f438dec

Stephen Ficklin 7 éve
szülő
commit
f850dda046

+ 13 - 5
tripal/api/tripal.notice.api.inc

@@ -86,6 +86,12 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
       break;
       break;
   }
   }
 
 
+  // If we are not set to return debugging information and the severity string
+  // is debug then don't report the error.
+  if (($severity == TRIPAL_DEBUG) AND (getenv('TRIPAL_DEBUG') != 1)) {
+      return FALSE;
+  }
+
   // Get the backtrace and include in the error message, but only if the
   // Get the backtrace and include in the error message, but only if the
   // TRIPAL_DEBUG environment variable is set.
   // TRIPAL_DEBUG environment variable is set.
   if (getenv('TRIPAL_DEBUG') == 1) {
   if (getenv('TRIPAL_DEBUG') == 1) {
@@ -98,7 +104,7 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
     }
     }
   }
   }
 
 
-  // Send to watchdog
+  // Send to watchdog.
   try {
   try {
     watchdog($type, $message, $variables, $severity);
     watchdog($type, $message, $variables, $severity);
   }
   }
@@ -107,7 +113,7 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
     $options['print'] = TRUE;
     $options['print'] = TRUE;
   }
   }
 
 
-  // Format the message for printing (either to the screen, log or both)
+  // Format the message for printing (either to the screen, log or both).
   if (sizeof($variables) > 0) {
   if (sizeof($variables) > 0) {
     $print_message = str_replace(array_keys($variables), $variables, $message);
     $print_message = str_replace(array_keys($variables), $variables, $message);
   }
   }
@@ -115,13 +121,15 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
     $print_message = $message;
     $print_message = $message;
   }
   }
 
 
-  // If print option supplied then print directly to the screen
+  // If print option supplied then print directly to the screen.
   if (isset($options['print'])) {
   if (isset($options['print'])) {
     print $severity_string . ' (' . strtoupper($type) . '): ' . $print_message . "\n";
     print $severity_string . ' (' . strtoupper($type) . '): ' . $print_message . "\n";
   }
   }
 
 
-  // Print to the Tripal error log
-  tripal_log('[' . strtoupper($type) . '] ' . $print_message . "\n", $severity_string);
+  // Print to the Tripal error log but only if the severity is not info.
+  if (($severity != TRIPAL_INFO)) {
+    tripal_log('[' . strtoupper($type) . '] ' . $print_message . "\n", $severity_string);
+  }
 
 
 }
 }
 
 

+ 2 - 2
tripal_chado_views/tripal_chado_views.views.inc

@@ -287,7 +287,7 @@ function tripal_chado_views_views_data() {
 
 
         tripal_report_error(
         tripal_report_error(
           'tripal_chado_views',
           'tripal_chado_views',
-          TRIPAL_WARNING,
+          TRIPAL_DEBUG,
           "The name and help were not set for %table.%column. As a consequence the column
           "The name and help were not set for %table.%column. As a consequence the column
             name has been used... You should ensure that the 'name' and 'help' keys for
             name has been used... You should ensure that the 'name' and 'help' keys for
             this field are set in the integration array (priority = %priority)",
             this field are set in the integration array (priority = %priority)",
@@ -328,7 +328,7 @@ function tripal_chado_views_views_data() {
       if ($num_handlers == 0) {
       if ($num_handlers == 0) {
         tripal_report_error(
         tripal_report_error(
           'tripal_chado_views',
           'tripal_chado_views',
-          TRIPAL_WARNING,
+          TRIPAL_DEBUG,
           "No handlers were registered for %table.%column. This means there is no views
           "No handlers were registered for %table.%column. This means there is no views
             functionality for this column. To register handlers, make sure the 'handlers'
             functionality for this column. To register handlers, make sure the 'handlers'
             key for this field is set in the integration array (priority = %priority).
             key for this field is set in the integration array (priority = %priority).