mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-23 00:43:48 +01:00
LSlog_handler : add excluded_loggers configuration parameter
This commit is contained in:
parent
aebdb4a111
commit
b574300ab3
2 changed files with 15 additions and 1 deletions
|
@ -198,6 +198,7 @@ $GLOBALS['LSlog']['handlers'] = array (
|
|||
//'level' => 'DEBUG',
|
||||
// Filter on specific loggers
|
||||
//'loggers' => array('LSurl', 'LSlang'),
|
||||
'excluded_loggers' => array('generate_lang_file', 'generate_ldapsaisie_pot'),
|
||||
// Default formats
|
||||
//'format' => '%{requesturi} - %{remoteaddr} - %{ldapservername} - %{authuser} - %{level} - %{message}',
|
||||
//'cli_format' => '%{clibinpath} - %{level} - %{message}',
|
||||
|
|
|
@ -40,6 +40,10 @@ class LSlog_handler {
|
|||
// Default datetime format
|
||||
protected $default_datetime_format = 'Y/m/d H:i:s';
|
||||
|
||||
// Loggers filters
|
||||
protected $loggers = array();
|
||||
protected $excluded_loggers = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -52,6 +56,9 @@ class LSlog_handler {
|
|||
$this -> loggers = $this -> getConfig('loggers', array());
|
||||
if (!is_array($this -> loggers))
|
||||
$this -> loggers = array($this -> loggers);
|
||||
$this -> excluded_loggers = $this -> getConfig('excluded_loggers', array());
|
||||
if (!is_array($this -> excluded_loggers))
|
||||
$this -> excluded_loggers = array($this -> excluded_loggers);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,7 +109,13 @@ class LSlog_handler {
|
|||
* @retval bool True if message of this logger have to be logged, False otherwise
|
||||
**/
|
||||
public function checkLogger($logger) {
|
||||
return (!$this -> loggers || in_array($logger, $this -> loggers));
|
||||
if (!$this -> loggers && !$this -> excluded_loggers)
|
||||
return true;
|
||||
if ($this -> loggers && in_array($logger, $this -> loggers))
|
||||
return true;
|
||||
if ($this -> excluded_loggers && !in_array($logger, $this -> excluded_loggers))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue