/** * Return the decision of this filter. * * @param Ideasa_Log4php_LoggerLoggingEvent $event * @return integer */ public function decide(Ideasa_Log4php_LoggerLoggingEvent $event) { $level = $event->getLevel(); if ($this->levelMin !== null) { if ($level->isGreaterOrEqual($this->levelMin) == false) { // level of event is less than minimum return Ideasa_Log4php_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 Ideasa_Log4php_LoggerFilter::DENY; } } if ($this->acceptOnMatch) { // this filter set up to bypass later filters and always return // accept if level in range return Ideasa_Log4php_LoggerFilter::ACCEPT; } else { // event is ok for this filter; allow later filters to have a look.. return Ideasa_Log4php_LoggerFilter::NEUTRAL; } }
/** * This method will return true if this repository is disabled * for level object passed as parameter and false otherwise. * @return boolean */ public function isDisabled(Ideasa_Log4php_LoggerLevel $level) { return $this->threshold->toInt() > $level->toInt(); }