Merge pull request #44262 from nextcloud/fix/log-on-invalid-loglevel

fix(Logger): Warn on invalid `loglevel` configuration option
This commit is contained in:
Joas Schilling 2024-03-18 10:59:28 +01:00 committed by GitHub
commit 3af954fcc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -282,7 +282,13 @@ class Log implements ILogger, IDataLogger {
}
$configLogLevel = $this->config->getValue('loglevel', ILogger::WARN);
return min(is_int($configLogLevel) ? $configLogLevel : ILogger::WARN, ILogger::FATAL);
if (is_numeric($configLogLevel)) {
return min((int)$configLogLevel, ILogger::FATAL);
}
// Invalid configuration, warn the user and fall back to default level of WARN
error_log('Nextcloud configuration: "loglevel" is not a valid integer');
return ILogger::WARN;
}
/**