Return the decision of this filter.

@param \n2n\log4php\logging\LoggingEvent $event
@return integer
486513
public function decide(\n2n\log4php\logging\LoggingEvent $event) {
		$level = $event->getLevel();
		
		if($this->levelMin !== null) {
			if($level->isGreaterOrEqual($this->levelMin) == false) {
				// level of event is less than minimum
				return \n2n\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 \n2n\log4php\LoggerFilter::DENY;
			}
		}

		if($this->acceptOnMatch) {
			// this filter set up to bypass later filters and always return
			// accept if level in range
			return \n2n\log4php\LoggerFilter::ACCEPT;
		} else {
			// event is ok for this filter; allow later filters to have a look..
			return \n2n\log4php\LoggerFilter::NEUTRAL;
		}
	}
586192
public function determineEventBinding(Event $event)
    {
        switch ($event->getCode()) {
            case Event::RESOURCE_DELETED:
                return 'delete';
                break;
            case Event::RESOURCE_CREATED:
                return 'create';
                break;
            case Event::RESOURCE_MODIFIED:
                return 'modify';
            break;
        }
    }
212330
public function append(\n2n\log4php\logging\LoggingEvent $event) {
		$priority = $this->getSyslogPriority($event->getLevel());
		$message = $this->layout->format($event);
	
		openlog($this->ident, $this->intOption, $this->intFacility);
		syslog($priority, $message);
		closelog();
	}
990423
public function logEvent(AbstractEvent $event)
    {
        $eventLog = EventLog::addEventEntry($event);

        return $this->repository->save($eventLog);
    }
1241360
public function onException(FilterExceptionEvent $event)
    {
        static $handling;

        if (true === $handling) {
            return false;
        }

        $handling = true;

        $exception = $event->getException();
        $request   = $event->getRequest();

        // This would be where we'd log, make another method that checks if logger is there and logs.

        $request = $this->duplicateRequest($exception, $request);

        try {
            $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST);
        } catch (\Exception $e) {
            // Log exception being thrown when trying to handle an exception.

            // Set handling to false otherwise it wont be able to handle further more
            $handling = false;

            // Re-throw the exception from within the kernel.
            throw $e;
        }

        $event->setResponse($response);

        $handling = false;
    }
1031765
public function onLog(LogGenericEvent $event)
    {
        $log = null;
        $logCreated = false;

        if (!($event instanceof LogNotRepeatableInterface) || !$this->isARepeat($event)) {
            $log = $this->createLog($event);
            $logCreated = true;
        }

        // Increment view count
        if ($event instanceof LogResourceReadEvent) {
            // Get connected user
            $tokenStorage = $this->container->get('security.token_storage');
            $token = $tokenStorage->getToken();
            $user = $token ? $token->getUser() : null;

            // Increment view count if viewer is not creator of the resource
            if (is_null($user) || is_string($user) || $user !== $event->getResource()->getCreator()) {
                // TODO : add me in an event on the resource 'open'
                $this->resourceManager->addView($event->getResource());
            }
            if ($logCreated && !empty($user) && 'anon.' !== $user && 'directory' !== $event->getResource()->getResourceType()->getName()) {
                $this->resourceEvalManager->updateResourceUserEvaluationData(
                    $event->getResource(),
                    $user,
                    new \DateTime(),
                    ['status' => AbstractResourceEvaluation::STATUS_OPENED],
                    ['status' => true],
                    false
                );
            }
        }
        if ($logCreated && $log && (
            $event instanceof LogUserLoginEvent ||
            $event instanceof LogWorkspaceEnterEvent ||
            $event instanceof LogResourceReadEvent ||
            $event instanceof LogWorkspaceToolReadEvent ||
            $event instanceof LogDesktopToolReadEvent ||
            $event instanceof LogAdminToolReadEvent
        )) {
            $this->logConnectManager->manageConnection($log);
        }
    }
362284
public function getTriggerByEvent($event) {
        $data = [ ];
        $data['event'] = $event;

        $result = $this->apiGet('trigger', $data);
        return $result;
    }
1084280
public function doAppend(\n2n\log4php\logging\LoggingEvent $event) {
		if($this->closed) {
			return;
		}
		
		if(!$this->isAsSevereAsThreshold($event->getLevel())) {
			return;
		}

		$filter = $this->getFirstFilter();
		while($filter !== null) {
			switch ($filter->decide($event)) {
				case \n2n\log4php\LoggerFilter::DENY: return;
				case \n2n\log4php\LoggerFilter::ACCEPT: return $this->append($event);
				case \n2n\log4php\LoggerFilter::NEUTRAL: $filter = $filter->getNext();
			}
		}
		$this->append($event);
	}
748353
public function get_context(event_interface $event) {
        global $USER;

        $courseid = $event->get_course() ? $event->get_course()->get('id') : null;
        $groupid = $event->get_group() ? $event->get_group()->get('id') : null;
        $userid = $event->get_user() ? $event->get_user()->get('id') : null;
        $moduleid = $event->get_course_module() ? $event->get_course_module()->get('id') : null;

        if (!empty($courseid)) {
            return \context_course::instance($event->get_course()->get('id'));
        } else if (!empty($groupid)) {
            $group = $this->get_group($event);
            return \context_course::instance($group->courseid);
        } else if (!empty($userid) && $userid == $USER->id) {
            return \context_user::instance($userid);
        } else if (!empty($userid) && $userid != $USER->id && $moduleid && $moduleid > 0) {
            $cm = $this->get_course_module($event);
            return \context_course::instance($cm->course);
        } else {
            return \context_user::instance($userid);
        }
    }
165359
private function determineFilterConfig(AbstractModelAwareEvent $event)
    {
        $environment  = $event->getEnvironment();
        $model        = $event->getModel();
        $dataProvider = $environment->getDataProvider($model->getProviderName());
        $definition   = $environment->getDataDefinition();
        $relationship = $definition->getModelRelationshipDefinition();

        $root = $relationship->getRootCondition();
        if (null !== $root && $root->matches($model)) {
            return $dataProvider->getEmptyConfig()->setFilter($root->getFilterArray());
        }

        $parentFilter = $relationship->getChildCondition(
            $definition->getBasicDefinition()->getParentDataProvider(),
            $model->getProviderName()
        );

        if (null !== $parentFilter) {
            $parentConfig   = $dataProvider->getEmptyConfig()->setFilter($parentFilter->getInverseFilterFor($model));
            $parentProvider = $environment->getDataProvider($parentFilter->getSourceName());
            $parent         = $parentProvider->fetchAll($parentConfig)->get(0);
            return $dataProvider->getEmptyConfig()->setFilter($parentFilter->getFilter($parent));
        }

        // Trigger BC layer in handleFallback().
        if ((null === $root) && (0 === \count($relationship->getChildConditions()))) {
            return null;
        }

        return $dataProvider->getEmptyConfig();
    }
397885
protected function getEventLogInfo(Event $event, $eventName)
    {
        if ($event instanceof EmbeddedEventResolverInterface) {
            return $event->getEventLogInfo($eventName);
        }

        if (null === $eventResolver = $this->getResolver($eventName)) {
            return null;
        }

        return $eventResolver->getEventLogInfo($event, $eventName);
    }
759661
private static function getRecorder(Event $event)
    {
        if (!isset(static::$recorder)) {
            $vendorDir = realpath(rtrim($event->getComposer()->getConfig()->get('vendor-dir'), '/'));
            $configDir = realpath($vendorDir.'/../app/config');
            $logger = new ConsoleIoLogger($event->getIO());
            $manager = $event->getComposer()->getRepositoryManager();
            $rootPackage = $event->getComposer()->getPackage();

            static::$recorder = new Recorder(
                $manager->getLocalRepository(),
                new Detector($vendorDir),
                new BundleHandler($configDir, $logger),
                $rootPackage->getAliases(),
                $vendorDir
            );
        }

        return static::$recorder;
    }
199392
private static function getApplication(Event $event)
    {
        if (null === self::$_application) {
            if (null !== $event->getDispatcher()) {
                self::$_application = $event->getDispatcher()->getApplication();
            }
        }

        return self::$_application;
    }
873391
protected function getValue($event)
    {
        if ($this->value === null && Yii::$app instanceof Application) {
            $ip = Yii::$app->request->userIP;
            if ($ip === null) {
                return $this->getDefaultValue($event);
            }
            return $ip;
        }
        return parent::getValue($event);
    }
250583
public function getEventLog(Event $event, $eventName)
    {
        $eventLog = $this->getEventLogObject($this->getEventLogInfo($event, $eventName));

        if (null === $eventLog) {
            return null;
        }

        $eventLog->setTypeId($eventName);
        $eventLog->setIp($this->getClientIp());
        $eventLog->setEventTime(new \DateTime());
        $this->setUser($eventLog);

        return $eventLog;
    }
121524
protected function _evaluateCondition($condition, Event $event)
    {
        if (!isset($this->_options[$condition])) {
            return $condition !== 'unless';
        }
        if (!is_callable($this->_options[$condition])) {
            throw new RuntimeException(self::class . ' the `' . $condition . '` condition is not a callable!');
        }

        return $this->_options[$condition]($event);
    }
650745
public function getOptions(GetPropertyOptionsEvent $event)
    {
        if (('range_template' !== $event->getPropertyName())
            || ('tl_metamodel_filtersetting' !== $event->getEnvironment()->getDataDefinition()->getName())
        ) {
            return;
        }

        $event->setOptions($this->templateList->getTemplatesForBase('mm_filteritem_'));
    }