/** * Return the decision of this filter. * * Returns {@link LoggerFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b> * option is not set or if there is not match. Otherwise, if there is a * match, then the returned decision is {@link LoggerFilter::ACCEPT} if the * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The * returned decision is {@link LoggerFilter::DENY} if the * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>. * * @param LoggerLoggingEvent $event * @return integer */ public function decide(LoggerLoggingEvent $event) { if ($this->levelToMatch === null) { return LoggerFilter::NEUTRAL; } if ($this->levelToMatch->equals($event->getLevel())) { return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::DENY; } else { return LoggerFilter::NEUTRAL; } }
/** * Return the decision of this filter. * * Returns {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} if the <b><var>LevelToMatch</var></b> * option is not set or if there is not match. Otherwise, if there is a * match, then the returned decision is {@link LOG4PHP_LOGGER_FILTER_ACCEPT} if the * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The * returned decision is {@link LOG4PHP_LOGGER_FILTER_DENY} if the * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>. * * @param LoggerLoggingEvent $event * @return integer */ function decide($event) { if ($this->levelToMatch === null) { return LOG4PHP_LOGGER_FILTER_NEUTRAL; } if ($this->levelToMatch->equals($event->getLevel())) { return $this->getAcceptOnMatch() ? LOG4PHP_LOGGER_FILTER_ACCEPT : LOG4PHP_LOGGER_FILTER_DENY; } else { return LOG4PHP_LOGGER_FILTER_NEUTRAL; } }