You are here

class RfcLogLevel in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Logger/RfcLogLevel.php \Drupal\Core\Logger\RfcLogLevel
  2. 9 core/lib/Drupal/Core/Logger/RfcLogLevel.php \Drupal\Core\Logger\RfcLogLevel

Defines various logging severity levels.

Hierarchy

Expanded class hierarchy of RfcLogLevel

Related topics

16 files declare their use of RfcLogLevel
AreaDisplayLinkTest.php in core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php
BigPipeTest.php in core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
bootstrap.inc in core/includes/bootstrap.inc
Functions that need to be loaded on every Drupal request.
dblog.admin.inc in core/modules/dblog/dblog.admin.inc
Administrative page callbacks for the Database Logging module.
DbLogController.php in core/modules/dblog/src/Controller/DbLogController.php

... See full list

File

core/lib/Drupal/Core/Logger/RfcLogLevel.php, line 33

Namespace

Drupal\Core\Logger
View source
class RfcLogLevel {

  /**
   * Log message severity -- Emergency: system is unusable.
   */
  const EMERGENCY = 0;

  /**
   * Log message severity -- Alert: action must be taken immediately.
   */
  const ALERT = 1;

  /**
   * Log message severity -- Critical conditions.
   */
  const CRITICAL = 2;

  /**
   * Log message severity -- Error conditions.
   */
  const ERROR = 3;

  /**
   * Log message severity -- Warning conditions.
   */
  const WARNING = 4;

  /**
   * Log message severity -- Normal but significant conditions.
   */
  const NOTICE = 5;

  /**
   * Log message severity -- Informational messages.
   */
  const INFO = 6;

  /**
   * Log message severity -- Debug-level messages.
   */
  const DEBUG = 7;

  /**
   * An array with the severity levels as keys and labels as values.
   *
   * @var array
   */
  protected static $levels;

  /**
   * Returns a list of severity levels, as defined in RFC 5424.
   *
   * @return array
   *   Array of the possible severity levels for log messages.
   *
   * @see http://tools.ietf.org/html/rfc5424
   * @ingroup logging_severity_levels
   */
  public static function getLevels() {
    if (!static::$levels) {
      static::$levels = [
        static::EMERGENCY => new TranslatableMarkup('Emergency'),
        static::ALERT => new TranslatableMarkup('Alert'),
        static::CRITICAL => new TranslatableMarkup('Critical'),
        static::ERROR => new TranslatableMarkup('Error'),
        static::WARNING => new TranslatableMarkup('Warning'),
        static::NOTICE => new TranslatableMarkup('Notice'),
        static::INFO => new TranslatableMarkup('Info'),
        static::DEBUG => new TranslatableMarkup('Debug'),
      ];
    }
    return static::$levels;
  }

}

Members