You are here

public function MigrationBase::loggingCallback in Migrate 6.2

Database logging callback - called when there's a database error. We log non-critical stuff, and throw an exception otherwise TODO: Eliminate in favor of hook_watchdog()?

Parameters

string $type: Ignored

string $message: Message to display or throw, potentially with t() placeholders

array $variables: Variables to substitute into $message

unknown_type $severity: Watchdog severity level

$link: ???

File

includes/base.inc, line 571
Defines the base class for migration processes.

Class

MigrationBase
The base class for all objects representing distinct steps in a migration process. Most commonly these will be Migration objects which actually import data from a source into a Drupal destination, but by deriving classes directly from MigrationBase…

Code

public function loggingCallback($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
  if ($severity == WATCHDOG_NOTICE || $severity == WATCHDOG_INFO || $severity == WATCHDOG_DEBUG) {
    $this
      ->saveMessage(t($message, $variables), MigrationBase::MESSAGE_INFORMATIONAL);
  }
  else {
    throw new MigrateException(t($message, $variables), MigrationBase::MESSAGE_ERROR);
  }
}