Update functions.lib.php

Remove useless verification on $level. Second check "in_array" line 624 is sufficient with strict mode.
Otherwise "Emerg level" is not possible with "empty($level).. LOG_EMERG = 0...
This commit is contained in:
All3kcis
2016-07-19 15:27:03 +02:00
committed by GitHub
parent d2209be6e3
commit f4705873cb

View File

@@ -619,11 +619,9 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
// If syslog module enabled
if (empty($conf->syslog->enabled)) return;
if (! empty($level))
{
// Test log level
$logLevels = array( LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG);
if (!in_array($level, $logLevels))
$logLevels = array(LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG);
if (!in_array($level, $logLevels, true))
{
throw new Exception('Incorrect log level');
}
@@ -666,7 +664,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
$loghandlerinstance->export($data,$suffixinfilename);
}
unset($data);
}
if (! empty($ident))
{