Logs a model event.

@param ModelEvent $event

@return void
503436
public function model(ModelEvent $event)
    {
        if (isset($this->logger)) {
            $operation = get_class($event);

            $model = $event->getModel();

            $on = get_class($model);

            $connection = $model->getQuery()->getConnection();

            $message = "LDAP ({$connection->getHost()})"
                . " - Connection: {$connection->getName()}"
                . " - Operation: {$operation}"
                . " - On: {$on}"
                . " - Distinguished Name: {$model->getDn()}";

            $this->logger->info($message);
        }
    }
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);
	}
1194841
public function addLogRecord($event) {
        /**
         * If logging is enabled
         */
        if ($event->sender->module->enableLog) {

            $userId = \Yii::$app->user->id;
            $order = $event->model;

            $message = "ID: $order->id userId: $userId";

            Yii::info($message, $event->name);
        }
    }
1027954
protected function fireSluggingEvent(Model $model, string $event)
    {
        return $this->events->until('eloquent.slugging: ' . get_class($model), [$model, $event]);
    }
810820
public function fireEvent(string $event): void
    {
        $this->log->debug('Event {event} has been fired.', ['event' => $event]);
        foreach ($this->event_handlers as $handler) {
            /** @var EventHandler $handler */
            if ($event === $handler->getEvent()) {
                $handler->execute();
            }
        }
    }
57608
public function doLogout(MvcEvent $event)
    {
        $application = $event->getApplication();
        $sm = $application->getServiceManager();
        /** @var \RcmUser\Service\RcmUserService $rcmUserService */
        $rcmUserService = $this->serviceLocator->get(
            \RcmUser\Service\RcmUserService::class
        );

        /** @var $request \Zend\Http\Request */
        $request = $sm->get('request');
        $logout = (bool)$request->getQuery('logout', 0);

        if ($logout) {
            $rcmUserService->clearIdentity();
            session_destroy();
            $request = explode('?', $_SERVER['REQUEST_URI']);
            header('Location: //' . $_SERVER['HTTP_HOST'] . $request[0]);
            die;
        }
    }
239683
public function handle(Logout $event)
    {
        if ($event->user) {
            $user = $event->user;
            $ip = $this->request->ip();
            $userAgent = $this->request->userAgent();
            $authenticationLog = $user->authentications()->whereIpAddress($ip)->whereUserAgent($userAgent)->first();

            if (! $authenticationLog) {
                $authenticationLog = new AuthenticationLog([
                    'ip_address' => $ip,
                    'user_agent' => $userAgent,
                ]);
            }

            $authenticationLog->logout_at = Carbon::now();

            $user->authentications()->save($authenticationLog);
        }
    }
878426
public function delete($event)
    {
        $formName = $event->sender->formName();
        $primaryKey = $event->sender->primaryKey;

        $this->model::deleteAll([
            'model' => $formName,
            'model_id' => $primaryKey,
        ]);
    }
1169458
function logEvent(model, event, state) {
  console.groupCollapsed('event:', event)
  console.log('new state:', state)
  if (model !== state.model) {
    console.log('model: from', model, 'to', state.model)
  } else {
    console.log('model (not changed):', model)
  }
  console.log('effect:', state.effect)
  console.groupEnd()
}
306987
protected function fireValidatingEvent(Model $model, $event)
    {
        return Event::until("eloquent.validating: ".get_class($model), [$model, $event]);
    }
68175
protected function _write($event)
    {
        $data = array();
        if (empty($this->getColumnMap())) {
            $data = $event;
        } else {
            foreach ($this->getColumnMap() as $name => $value) {
                if (isset($event[$name])) {
                    $data[$name] = $event[$name];
                }
            }
        }

        $entry = new $this->modelClass();
        $entry->fromArray($data);
        $entry->save();

        return $this;
    }
1203347
private function logEventsToFile($model)
    {
        $user = auth()->user();
        $class = class_basename($model);
        $trace = debug_backtrace();
        $event = $trace[2] ? $trace[2]['function'] : "Unknown event";

        if (auth()->check()) {
            Log::info("{$class} id {$model->id} {$event} by user id {$user->id} ({$user->email}).");
        } else {
            Log::info("{$class} id {$model->id} {$event} by unknown user.");
        }
    }
278533
public function handle(Login $event)
    {
        $model = snake_case(class_basename($event->user));
        $data = [
            'ip'       => request()->ip(),
            'ua'       => request()->header('User-Agent'),
            'remember' => $event->remember,
        ];
        $event->user->log("{$model}.login", $data);
    }
289153
private function updateCounter(ModelEvent $event, $action)
    {
        if (!$this->constraint->isVersioningService()) {
            return;
        }

        $qb = $this->documentManager->createQueryBuilder($event->getCollectionClass());
        if ('update' == $action) {
            $qb->findAndUpdate()
                ->field('id')->equals($event->getCollectionId())
                ->field(VersionServiceConstraint::FIELD_NAME)->inc(1)
                ->getQuery()->execute();
        } else {
            $qb->findAndUpdate()
                ->field('id')->equals($event->getCollectionId())
                ->field(VersionServiceConstraint::FIELD_NAME)->set(1)
                ->getQuery()->execute();
        }
    }
667630
public function beforeValidate(ModelEvent $event)
    {
        if ($this->_relationsSaveStarted === false && !empty($this->_oldRelationValue)) {
            /* @var $model BaseActiveRecord */
            $model = $this->owner;
            if ($this->saveRelatedRecords($model, $event)) {
                // If relation is has_one, try to set related model attributes
                foreach ($this->_relations as $relationName) {
                    if (array_key_exists($relationName, $this->_oldRelationValue)) { // Relation was not set, do nothing...
                        $this->_setRelationForeignKeys($relationName);
                    }
                }
            }
        }
    }
750795
private function captureStepEvent(Event $event)
    {
        if ($event instanceof AfterStepTested) {
            $this->afterStepTestedEvents[$event->getStep()->getLine()] = $event;
        }
        if ($event instanceof AfterStepSetup) {
            $this->afterStepSetupEvents[$event->getStep()->getLine()] = $event;
        }
    }
329188
public function collectLogs($event)
	{
		$logger=Yii::getLogger();
		$dumpLogs=isset($event->params['dumpLogs']) && $event->params['dumpLogs'];
		foreach($this->_routes as $route)
		{
			/* @var $route CLogRoute */
			if($route->enabled)
				$route->collectLogs($logger,$dumpLogs);
		}
	}