Explorar el Código

Reduced poluting of log files by not printing INFO to apache error log and only showing debug if indicated we should by TRIPAL_DEBUG environment varianble. Furthermore, made tripal views less verbose (moved some messages to debug).

Lacey Sanderson hace 8 años
padre
commit
f438dec3b7

+ 12 - 5
tripal_core/api/tripal_core.tripal.api.inc

@@ -97,6 +97,12 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
       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
   // TRIPAL_DEBUG environment variable is set.
   if (getenv('TRIPAL_DEBUG') == 1) {
@@ -109,7 +115,7 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
     }
   }
 
-  // Send to watchdog
+  // Send to watchdog.
   try {
     watchdog($type, $message, $variables, $severity);
   }
@@ -126,14 +132,15 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
     $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'])) {
     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_views/tripal_views.views.inc

@@ -224,7 +224,7 @@ function tripal_views_views_data() {
 
         tripal_report_error(
           'tripal_views',
-          TRIPAL_WARNING,
+          TRIPAL_DEBUG,
           "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
             this field are set in the integration array (priority = %priority)",
@@ -265,7 +265,7 @@ function tripal_views_views_data() {
       if ($num_handlers == 0) {
         tripal_report_error(
           'tripal_views',
-          TRIPAL_WARNING,
+          TRIPAL_DEBUG,
           "No handlers were registered for %table.%column. This means there is no views
             functionality for this column. To register handlers, make sure the 'handlers'
             key for this field is set in the integration array (priority = %priority).