1 bootstrap.inc | watchdog_severity_enabled($severity = WATCHDOG_NOTICE) |
Check if logging is enabled for a given severity level.
@since 1.5.0
Parameters
int $severity: One of the WATCHDOG_* severity constants.
Return value
TRUE if enabled, FALSE otherwise.:
See also
File
- core/
includes/ bootstrap.inc, line 2261 - Functions that need to be loaded on every Backdrop request.
Code
function watchdog_severity_enabled($severity = WATCHDOG_NOTICE) {
try {
$enabled_severity_levels = function_exists('config') ? config('system.core')->get('watchdog_enabled_severity_levels') : array();
}
catch (Exception $e) {
$enabled_severity_levels = array();
}
// This may be called before system.core, such as when running update.php or
// the initial installation. As such we provide the defaults if needed.
if (!isset($enabled_severity_levels)) {
// See watchdog_severity_levels() for possible values.
$enabled_severity_levels = array(
WATCHDOG_EMERGENCY,
WATCHDOG_ALERT,
WATCHDOG_CRITICAL,
WATCHDOG_ERROR,
WATCHDOG_WARNING,
WATCHDOG_NOTICE,
WATCHDOG_INFO,
);
}
// Return TRUE if the severity level is enabled.
return in_array($severity, $enabled_severity_levels);
}