function drupal_error_levels

Same name in other branches
  1. 7.x includes/errors.inc \drupal_error_levels()
  2. 9 core/includes/errors.inc \drupal_error_levels()
  3. 8.9.x core/includes/errors.inc \drupal_error_levels()
  4. 11.x 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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.