function tripal_log

2.x tripal_core.tripal.api.inc tripal_log($message, $type = 'error', $options = array())
3.x tripal.notice.api.inc tripal_log($message, $type = 'error', $options = array())

File-based Logging for Tripal

Parameters

$message: The message to be logged. Need not contain date/time information

$log_type: The type of log. Should be one of 'error' or 'job' although other types are supported.

$options: An array of options where the following keys are supported:

  • first_progress_bar: this sohuld be used for the first log call for a progress bar.
  • is_progress_bar: this option should be used for all but the first print of a progress bar to allow it all to be printed on the same line without intervening date prefixes.

Return value

The number of bytes that were written to the file, or FALSE on failure

1 call to tripal_log()
tripal_report_error in tripal_core/api/tripal_core.tripal.api.inc
Provide better error notice for Tripal. If the environment variable 'TRIPAL_DEBUG' is set to 1 then this function will add backtrace information to the message.

File

tripal_core/api/tripal_core.tripal.api.inc, line 239
Provides an application programming interface (API) for Tripal

Code

function tripal_log($message, $type = 'error', $options = array()) {
  global $base_url;
  $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 = $prefix . trim($message);
  }

  return error_log($message);

}