You are here

public function LogEntry::formatSeverity in Ultimate Cron 8.2

Format severity.

File

src/Logger/LogEntry.php, line 215

Class

LogEntry
Class for Ultimate Cron log entries.

Namespace

Drupal\ultimate_cron\Logger

Code

public function formatSeverity() {
  switch ($this->severity) {
    case RfcLogLevel::EMERGENCY:
    case RfcLogLevel::ALERT:
    case RfcLogLevel::CRITICAL:
    case RfcLogLevel::ERROR:
      $file = 'core/misc/icons/e32700/error.svg';
      break;
    case RfcLogLevel::WARNING:
      $file = 'core/misc/icons/e29700/warning.svg';
      break;
    case RfcLogLevel::NOTICE:

      // @todo Look for a better icon.
      $file = 'core/misc/icons/008ee6/twistie-up.svg';
      break;
    case RfcLogLevel::INFO:
    case RfcLogLevel::DEBUG:
    default:
      $file = 'core/misc/icons/73b355/check.svg';
  }
  $status = [
    '#theme' => 'image',
    '#uri' => $file,
  ];
  $severity_levels = array(
    -1 => t('no info'),
  ) + RfcLogLevel::getLevels();
  $title = $severity_levels[$this->severity];
  return array(
    $status,
    $title,
  );
}