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.

Related topics

1 call to tripal_log()
tripal_report_error in tripal/api/tripal.notice.api.inc
Provide better error notice for Tripal.

File

tripal/api/tripal.notice.api.inc, line 238
Provides an application programming interface (API) for improved user notifications. These API functions can be used to set messages for end-users, administrators, or simple logging.

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);

}