/**
  * Configures a logger. 
  * 
  * @param Logger $logger The logger to configure
  * @param array $config Logger configuration options.
  */
 private function configureLogger(Payone_Log4php_Logger $logger, $config)
 {
     $loggerName = $logger->getName();
     // Set logger level
     if (isset($config['level'])) {
         $level = Payone_Log4php_LoggerLevel::toLevel($config['level']);
         if (isset($level)) {
             $logger->setLevel($level);
         } else {
             $default = $logger->getLevel();
             $this->warn("Invalid level value [{$config['level']}] specified for logger [{$loggerName}]. Ignoring level definition.");
         }
     }
     // Link appenders to logger
     if (isset($config['appenders'])) {
         foreach ($config['appenders'] as $appenderName) {
             if (isset($this->appenders[$appenderName])) {
                 $logger->addAppender($this->appenders[$appenderName]);
             } else {
                 $this->warn("Nonexistnant appender [{$appenderName}] linked to logger [{$loggerName}].");
             }
         }
     }
     // Set logger additivity
     if (isset($config['additivity'])) {
         $additivity = Payone_Log4php_LoggerOptionConverter::toBoolean($config['additivity'], null);
         if (is_bool($additivity)) {
             $logger->setAdditivity($additivity);
         } else {
             $this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [{$loggerName}]. Ignoring additivity setting.");
         }
     }
 }
Exemple #2
0
 /**
  * Setting a null value to the level of the root category may have catastrophic results.
  * @param Payone_Log4php_LoggerLevel $level
  */
 public function setLevel($level)
 {
     if ($level != null) {
         parent::setLevel($level);
     }
 }