You are here

function migrate_watchdog in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 migrate.module \migrate_watchdog()

Implementation of hook_watchdog(). Find the migration that is currently running and notify it.

Parameters

array $log_entry:

File

./migrate.module, line 448

Code

function migrate_watchdog($log_entry) {

  // Ensure that the Migration class exists, as different bootstrap phases may
  // not have included migration.inc yet.
  if (class_exists('Migration') && ($migration = Migration::currentMigration())) {
    switch ($log_entry['severity']) {
      case WATCHDOG_EMERG:
      case WATCHDOG_ALERT:
      case WATCHDOG_CRITICAL:
      case WATCHDOG_ERROR:
        $severity = MigrationBase::MESSAGE_ERROR;
        break;
      case WATCHDOG_WARNING:
        $severity = MigrationBase::MESSAGE_WARNING;
        break;
      case WATCHDOG_NOTICE:
        $severity = MigrationBase::MESSAGE_NOTICE;
        break;
      case WATCHDOG_DEBUG:
      case WATCHDOG_INFO:
      default:
        $severity = MigrationBase::MESSAGE_INFORMATIONAL;
        break;
    }
    $variables = is_array($log_entry['variables']) ? $log_entry['variables'] : array();
    $migration
      ->saveMessage(t($log_entry['message'], $variables), $severity);
  }
}