Merge pull request #5507 from all3kcis/patch-3

Debug dol_syslog function
This commit is contained in:
Laurent Destailleur 2016-07-20 18:12:39 +02:00 committed by GitHub
commit c8ff56ac04

View File

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