/**
  * Return the decision of this filter.
  *
  * @param LoggerLoggingEvent $event
  * @return integer
  */
 public function decide(LoggerLoggingEvent $event)
 {
     $level = $event->getLevel();
     if ($this->levelMin !== null) {
         if ($level->isGreaterOrEqual($this->levelMin) == false) {
             // level of event is less than minimum
             return LoggerFilter::DENY;
         }
     }
     if ($this->levelMax !== null) {
         if ($level->toInt() > $this->levelMax->toInt()) {
             // level of event is greater than maximum
             // Alas, there is no Level.isGreater method. and using
             // a combo of isGreaterOrEqual && !Equal seems worse than
             // checking the int values of the level objects..
             return LoggerFilter::DENY;
         }
     }
     if ($this->acceptOnMatch) {
         // this filter set up to bypass later filters and always return
         // accept if level in range
         return LoggerFilter::ACCEPT;
     } else {
         // event is ok for this filter; allow later filters to have a look..
         return LoggerFilter::NEUTRAL;
     }
 }
Beispiel #2
0
 /**
  * Returns true if the hierarchy is disabled for given log level and false
  * otherwise.
  * @return boolean
  */
 public function isDisabled(LoggerLevel $level)
 {
     return $this->threshold->toInt() > $level->toInt();
 }
 protected function getGELFLevel(LoggerLevel $level)
 {
     $int = $level->toInt();
     if (isset($this->_levelMap[$int])) {
         return $this->_levelMap[$int];
     } else {
         return self::DEBUG;
     }
 }
 /** Determines which syslog priority to use based on the given level. */
 private function getSyslogPriority(LoggerLevel $level)
 {
     if ($this->overridePriority) {
         return $this->intPriority;
     }
     $int = $level->toInt();
     if (isset($this->levelMap[$int])) {
         return $this->levelMap[$int];
     } else {
         return LOG_DEBUG;
     }
 }
 /**
  * @param LoggerLevel $level
  * @return int
  */
 public function getGelfLevel(LoggerLevel $level)
 {
     $int = $level->toInt();
     if (isset($this->levelMap[$int])) {
         return $this->levelMap[$int];
     } else {
         return self::LEVEL_ALERT;
     }
 }