Browse Source

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 8 years ago
parent
commit
f438dec3b7
2 changed files with 14 additions and 7 deletions
  1. 12 5
      tripal_core/api/tripal_core.tripal.api.inc
  2. 2 2
      tripal_views/tripal_views.views.inc

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

@@ -97,6 +97,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) {
@@ -109,7 +115,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);
   }
   }
@@ -126,14 +132,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_views/tripal_views.views.inc

@@ -224,7 +224,7 @@ function tripal_views_views_data() {
 
 
         tripal_report_error(
         tripal_report_error(
           'tripal_views',
           'tripal_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)",
@@ -265,7 +265,7 @@ function tripal_views_views_data() {
       if ($num_handlers == 0) {
       if ($num_handlers == 0) {
         tripal_report_error(
         tripal_report_error(
           'tripal_views',
           'tripal_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).