You are here

function drupal_error_levels in Drupal 10

Same name and namespace in other branches
  1. 8 core/includes/errors.inc \drupal_error_levels()
  2. 7 includes/errors.inc \drupal_error_levels()
  3. 9 core/includes/errors.inc \drupal_error_levels()

Maps PHP error constants to watchdog severity levels.

The error constants are documented at http://php.net/manual/errorfunc.constants.php

Related topics

1 call to drupal_error_levels()
_drupal_error_handler_real in core/includes/errors.inc
Provides custom PHP error handling.

File

core/includes/errors.inc, line 24
Functions for error handling.

Code

function drupal_error_levels() {
  $types = [
    E_ERROR => [
      'Error',
      RfcLogLevel::ERROR,
    ],
    E_WARNING => [
      'Warning',
      RfcLogLevel::WARNING,
    ],
    E_PARSE => [
      'Parse error',
      RfcLogLevel::ERROR,
    ],
    E_NOTICE => [
      'Notice',
      RfcLogLevel::NOTICE,
    ],
    E_CORE_ERROR => [
      'Core error',
      RfcLogLevel::ERROR,
    ],
    E_CORE_WARNING => [
      'Core warning',
      RfcLogLevel::WARNING,
    ],
    E_COMPILE_ERROR => [
      'Compile error',
      RfcLogLevel::ERROR,
    ],
    E_COMPILE_WARNING => [
      'Compile warning',
      RfcLogLevel::WARNING,
    ],
    E_USER_ERROR => [
      'User error',
      RfcLogLevel::ERROR,
    ],
    E_USER_WARNING => [
      'User warning',
      RfcLogLevel::WARNING,
    ],
    E_USER_NOTICE => [
      'User notice',
      RfcLogLevel::NOTICE,
    ],
    E_STRICT => [
      'Strict warning',
      RfcLogLevel::DEBUG,
    ],
    E_RECOVERABLE_ERROR => [
      'Recoverable fatal error',
      RfcLogLevel::ERROR,
    ],
    E_DEPRECATED => [
      'Deprecated function',
      RfcLogLevel::DEBUG,
    ],
    E_USER_DEPRECATED => [
      'User deprecated function',
      RfcLogLevel::DEBUG,
    ],
  ];
  return $types;
}