You are here

class DrupalSetMessageLogger in Backup and Migrate 8.4

Class DrupalLogger.

@package BackupMigrate\Drupal\Environment

This logger sends messages to the browser when Backup and Migrate is run in interactive mode.

Hierarchy

Expanded class hierarchy of DrupalSetMessageLogger

File

src/Environment/DrupalSetMessageLogger.php, line 16

Namespace

BackupMigrate\Drupal\Environment
View source
class DrupalSetMessageLogger extends AbstractLogger {

  /**
   * Logs with an arbitrary level.
   *
   * @param mixed $level
   * @param string $message
   * @param array $context
   *
   * @return null
   */
  public function log($level, $message, array $context = []) {

    // Translate the PSR logging level to a drupal message type.
    switch ($level) {
      case LogLevel::EMERGENCY:
      case LogLevel::ALERT:
      case LogLevel::CRITICAL:
      case LogLevel::ERROR:
        $type = 'error';
        break;
      case LogLevel::WARNING:
      case LogLevel::NOTICE:
        $type = 'warning';
        break;
      default:
        $type = 'status';
        break;
    }

    // @TODO: Handle translations properly.
    drupal_set_message($message, $type, FALSE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalSetMessageLogger::log public function Logs with an arbitrary level.