fix(Logger): Warn on invalid `loglevel` configuration option

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2024-03-17 20:20:43 +01:00
parent 575fb8d7a6
commit e838aa9514
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
1 changed files with 7 additions and 1 deletions

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