public function TripalImporter::logMessage

3.x TripalImporter.inc public TripalImporter::logMessage($message, $variables = array(), $severity = TRIPAL_INFO)

Logs a message for the importer.

There is no distinction between status messages and error logs. Any message that is intended for the user to review the status of the loading can be provided here. If this importer is associated with a job then the logging is passed on to the job for storage.

Messages that are are of severity TRIPAL_CRITICAL or TRIPAL_ERROR are also logged to the watchdog.

Parameters

$message: The message to store in the log. Keep $message translatable by not concatenating dynamic values into it! Variables in the message should be added by using placeholder strings alongside the variables argument to declare the value of the placeholders. See t() for documentation on how $message and $variables interact.

$variables: Array of variables to replace in the message on display or NULL if message is already translated or not possible to translate.

$severity: The severity of the message; one of the following values:

18 calls to TripalImporter::logMessage()
FASTAImporter::loadFasta in tripal_chado/includes/TripalImporter/FASTAImporter.inc
Load a fasta file.
FASTAImporter::loadFastaFeature in tripal_chado/includes/TripalImporter/FASTAImporter.inc
A helper function for loadFasta() to load a single feature
GFF3Importer::loadAlias in tripal_chado/includes/TripalImporter/GFF3Importer.inc
Load any aliases for a feature
GFF3Importer::loadDbxref in tripal_chado/includes/TripalImporter/GFF3Importer.inc
Load the dbxref attribute for a feature
GFF3Importer::loadDerivesFrom in tripal_chado/includes/TripalImporter/GFF3Importer.inc
Load the derives from attribute for a gff3 feature

... See full list

File

tripal/includes/TripalImporter.inc, line 545

Class

TripalImporter

Code

public function logMessage($message, $variables = array(), $severity = TRIPAL_INFO) {
  // Generate a translated message.
  $tmessage = t($message, $variables);


  // If we have a job then pass along the messaging to the job.
  if ($this->job) {
    $this->job->logMessage($message, $variables, $severity);
  }
  // If we don't have a job then just use the drpual_set_message.
  else {
    // Report this message to watchdog or set a message.
    if ($severity == TRIPAL_CRITICAL or $severity == TRIPAL_ERROR) {
      drupal_set_message($tmessage, 'error');
    }
    if ($severity == TRIPAL_WARNING) {
      drupal_set_message($tmessage, 'warning');
    }
  }
}