|
@@ -86,6 +86,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) {
|
|
@@ -98,7 +104,7 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Send to watchdog
|
|
|
+ // Send to watchdog.
|
|
|
try {
|
|
|
watchdog($type, $message, $variables, $severity);
|
|
|
}
|
|
@@ -107,7 +113,7 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
|
|
|
$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) {
|
|
|
$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;
|
|
|
}
|
|
|
|
|
|
- // 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);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|