mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
logging: Fix that setting a numeric log level is flawed
This commit is contained in:
parent
f68c591a46
commit
f44b0525d8
@ -84,7 +84,8 @@ class Logger
|
|||||||
|
|
||||||
if (($level = $config->level) !== null) {
|
if (($level = $config->level) !== null) {
|
||||||
if (is_numeric($level)) {
|
if (is_numeric($level)) {
|
||||||
if (! isset(static::$levels[(int) $level])) {
|
$level = (int) $level;
|
||||||
|
if (! isset(static::$levels[$level])) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
'Can\'t set logging level %d. Logging level is not defined. Use one of %s or one of the'
|
'Can\'t set logging level %d. Logging level is not defined. Use one of %s or one of the'
|
||||||
. ' Logger\'s constants.',
|
. ' Logger\'s constants.',
|
||||||
@ -92,7 +93,7 @@ class Logger
|
|||||||
implode(', ', array_keys(static::$levels))
|
implode(', ', array_keys(static::$levels))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->level = static::$levels[(int) $level];
|
$this->level = $level;
|
||||||
} else {
|
} else {
|
||||||
$level = strtoupper($level);
|
$level = strtoupper($level);
|
||||||
$levels = array_flip(static::$levels);
|
$levels = array_flip(static::$levels);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user