瀏覽代碼

Fixed logging to file to include the URL of the website logging the error. This makes it easier to read the log file when there is more than one Drupal site on the same machine.

Lacey Sanderson 9 年之前
父節點
當前提交
e8d61cc118
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      tripal_core/api/tripal_core.tripal.api.inc

+ 3 - 3
tripal_core/api/tripal_core.tripal.api.inc

@@ -126,7 +126,7 @@ function tripal_report_error($type, $severity, $message, $variables = array(), $
   }
 
   // Print to the Tripal error log
-  tripal_log( $severity_string . ' (' . strtoupper($type) . '): ' . $print_message . "\n", 'error');
+  tripal_log('[' . strtoupper($type) . '] ' . $print_message . "\n", $severity_string);
 
 }
 
@@ -221,14 +221,14 @@ function tripal_set_message($message, $importance = TRIPAL_INFO, $options = arra
  */
 function tripal_log($message, $type = 'error', $options = array()) {
   global $base_url;
-  $prefix = '[TRIPAL ' . strtoupper(check_plain($type)) . '] ';
+  $prefix = '[site ' . $base_url . '] [TRIPAL ' . strtoupper(check_plain($type)) . '] ';
 
   if (!isset($options['is_progress_bar'])) {
     $message = $prefix . str_replace("\n", "", trim($message));
   }
 
   if (isset($options['first_progress_bar'])) {
-    $message = trim($message);
+    $message = $prefix . trim($message);
   }
 
   return error_log($message);