@DI\Observe("log")

@param LogGenericEvent $event
433996
public function onDeleteUser(LogGenericEvent $event)
    {
        if ($event instanceof LogUserDeleteEvent) {
            $receiver = $event->getReceiver();
            if (null !== $receiver) {
                $this->externalSyncUserManager->deleteExternalUserByUserId($receiver->getId());
            }
        }
    }
1364123
public function onReflectComplete(GenericEvent $event)
    {
        $context = $event->getArguments();
        unset($context['extra']);
        $this->logger->notice('Parsing data source "{source}" completed.', $context);
    }
177832
public function trigger(Event $event) {
    $request = $event->getTarget();
    
    $cachedRequest = new CachedRequest($request->getURL());
    $cachedRequest->setCachedResponse($event->getData()->response);
    $cachedRequest->setHeaders($event->getData()->headers);
    
    $this->addCachedRequest($cachedRequest);
  }
471227
public function recordException(MessageLogged $event)
    {
        if (! Telescope::isRecording() || $this->shouldIgnore($event)) {
            return;
        }

        $exception = $event->context['exception'];

        Telescope::recordException(
            IncomingExceptionEntry::make($exception, [
                'class' => get_class($exception),
                'file' => $exception->getFile(),
                'line' => $exception->getLine(),
                'message' => $exception->getMessage(),
                'trace' => $exception->getTrace(),
                'line_preview' => ExceptionContext::get($exception),
            ])->tags($this->tags($event))
        );
    }
990423
public function logEvent(AbstractEvent $event)
    {
        $eventLog = EventLog::addEventEntry($event);

        return $this->repository->save($eventLog);
    }
70339
public function onLogEvent(LogEvent $event)
    {
        $context = $event->getContext();
        $context['event.name'] = $event->getEventNameContext();

        $eventSubscriberClassName = get_class($event->getEventSubscriberContext());
        if (strrpos($eventSubscriberClassName, '\\') !== false) {
            $eventSubscriberClassName = substr($eventSubscriberClassName, strrpos($eventSubscriberClassName, '\\') + 1);
        }
        $context['event.task.name'] = $eventSubscriberClassName;

        $this->logger->log($event->getLevel(), $event->getMessage(), $context);
    }
1173666
public function onKernelException(GetResponseForExceptionEvent $event)
    {
        $this->log = $this->logging->createLog($event->getRequest(), $event->getException()->getMessage());
    }
85254
public function logActivity($event)
    {
        // if cronjob / no user
        if (user()->id <= 0) {
            return;
        }

        // log adjustment
        LogAdminActivity::create([
            'subject_id'   => $this->id,
            'subject_type' => get_class($this),
            'name'         => $this->getActivityName($this, $event),
            'before'       => $this->before,
            'after'        => $this->after,
            'user_id'      => user()->id,
        ]);
    }
1062047
protected function when(DomainEvent $event)
    {
        $method = 'when' . ClassToString::short($event);
        if (is_callable([$this, $method])) {
            $this->{$method}($event);
        }
    }
657857
public function onReflectError(GenericEvent $event)
    {
        $context = $event->getArguments();
        $this->logger->error('Parser has detected an error on file "{file}". {error}', $context);
    }
301743
public function onGenerateResourceTracking(GenericDataEvent $event)
    {
        $data = $event->getData();
        $node = $data['resourceNode'];
        $user = $data['user'];
        $startDate = $data['startDate'];

        $logs = $this->evaluationManager->getLogsForResourceTracking(
            $node,
            $user,
            ['resource-read', 'resource-icap_wiki-section_create', 'resource-icap_wiki-section_update'],
            $startDate
        );
        $nbLogs = count($logs);

        if ($nbLogs > 0) {
            $this->om->startFlushSuite();
            $tracking = $this->evaluationManager->getResourceUserEvaluation($node, $user);
            $tracking->setDate($logs[0]->getDateLog());
            $status = AbstractResourceEvaluation::STATUS_UNKNOWN;
            $nbAttempts = 0;
            $nbOpenings = 0;

            foreach ($logs as $log) {
                switch ($log->getAction()) {
                    case 'resource-read':
                        ++$nbOpenings;

                        if (AbstractResourceEvaluation::STATUS_UNKNOWN === $status) {
                            $status = AbstractResourceEvaluation::STATUS_OPENED;
                        }
                        break;
                    case 'resource-icap_wiki-section_create':
                    case 'resource-icap_wiki-section_update':
                        ++$nbAttempts;
                        $status = AbstractResourceEvaluation::STATUS_PARTICIPATED;
                        break;
                }
            }
            $tracking->setStatus($status);
            $tracking->setNbAttempts($nbAttempts);
            $tracking->setNbOpenings($nbOpenings);
            $this->om->persist($tracking);
            $this->om->endFlushSuite();
        }
        $event->stopPropagation();
    }
1137627
public function onCommand(ConsoleCommandEvent $event)
    {
        $output = $event->getOutput();
        if ($output instanceof ConsoleOutputInterface) {
            $output = $output->getErrorOutput();
        }

        $this->setOutput($output);
    }
1078126
public function onLog(LogGenericEvent $event)
    {
        if ($event instanceof LogRoleSubscribeEvent) {
            $role = $event->getRole();
            $workspace = $role->getWorkspace();

            if (!empty($workspace)) {
                $this->manager->generateScheduledTasks(
                    $event->getActionKey(),
                    $event->getReceiver(),
                    $workspace,
                    $event->getReceiverGroup(),
                    $role
                );
            }
        } elseif ($event instanceof LogWorkspaceEnterEvent) {
            $user = $this->tokenStorage->getToken()->getUser();

            if ('anon.' !== $user) {
                $this->manager->generateScheduledTasks($event->getAction(), $user, $event->getWorkspace());
            }
        }
    }
698904
final protected function apply(DomainEvent $event) : void
    {
        $this->handleEventInAggregate($event);
        parent::raise($event);
    }
984584
public function onLog(LogGenericEvent $event)
    {
        if ($event instanceof PotentialEvaluationEndInterface) {
            $correction = $event->getCorrection();
            $this->sendFinishedLog($correction->getDrop());
            if ($correction->getDrop()->getUser()->getId() !== $correction->getUser()->getId()) {
                $drop = $this->entityManager->getRepository('IcapDropzoneBundle:Drop')->findOneBy(['user' => $correction->getUser()]);
                if (null !== $drop) {
                    $this->sendFinishedLog($drop);
                }
            }
        }
    }
429784
public function logErrorEvent($event)
    {
        // create a new AuditError
        $auditError = new AuditError;
        $auditError->created = time();
        $auditError->status = 'new';
        $auditError->code = 500;
        $auditError->message = $event->message;
        $auditError->file = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $event->file);
        $auditError->line = $event->line;
        $auditError->source_code = AuditHelper::pack($this->renderSourceCode($auditError->file, $auditError->line, $this->maxSourceLines));

        // get the trace info and stack_dump
        $trace = debug_backtrace();
        // skip the first 3 stacks as they do not tell the error position
        if (count($trace) > 6)
            $trace = array_slice($trace, 6);
        $auditError->trace = '';
        foreach ($trace as $i => $t) {
            if (!isset($t['file']))
                $trace[$i]['file'] = 'unknown';
            $trace[$i]['file'] = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $trace[$i]['file']);

            if (!isset($t['line']))
                $trace[$i]['line'] = 0;

            if (!isset($t['function']))
                $trace[$i]['function'] = 'unknown';

            $auditError->trace .= "#$i {$trace[$i]['file']}({$trace[$i]['line']}): ";
            if (isset($t['object']) && is_object($t['object']))
                $auditError->trace .= get_class($t['object']) . '->';
            $auditError->trace .= "{$trace[$i]['function']}()\n";

            unset($trace[$i]['object']);

            if (isset($trace[$i]['args']))
                $trace[$i]['args'] = $this->cleanTrace($trace[$i]['args']);
        }
        $auditError->traces = json_encode($trace);
        $auditError->stack_trace = AuditHelper::pack($this->renderStackTrace($trace));

        // get the type info
        switch ($event->code) {
            case E_WARNING:
                $auditError->type = 'PHP warning';
                break;
            case E_NOTICE:
                $auditError->type = 'PHP notice';
                break;
            case E_USER_ERROR:
                $auditError->type = 'User error';
                break;
            case E_USER_WARNING:
                $auditError->type = 'User warning';
                break;
            case E_USER_NOTICE:
                $auditError->type = 'User notice';
                break;
            case E_RECOVERABLE_ERROR:
                $auditError->type = 'Recoverable error';
                break;
            default:
                $auditError->type = 'PHP error';
        }

        // get the AuditRequest
        $auditRequest = $this->getAuditRequest();
        $auditError->audit_request_id = $auditRequest ? $auditRequest->id : 0;

        // generate a hash of the error
        $auditError->hash = $this->hash($auditError->message . $auditError->file . $auditError->line);

        // save the AuditError
        $auditError->save(false);
    }
338624
protected function start(Event $event): void
    {
        // if sendOutputTo or appendOutputTo have been specified
        if (!$event->nullOutput()) {
            // if sendOutputTo then truncate the log file if it exists
            if (!$event->shouldAppendOutput) {
                $f = @\fopen($event->output, 'r+');
                if (false !== $f) {
                    \ftruncate($f, 0);
                    \fclose($f);
                }
            }
            // Create an instance of the Logger specific to the event
            $event->logger = $this->loggerFactory->create(
                [
                    // Logging streams
                    'info' => $event->output,
                ]
            );
        }

        $this->consoleLogger
            ->debug("Invoke Event's ping before.");

        $this->pingBefore($event);

        // Running the before-callbacks
        $event->outputStream = ($this->invoke($event->beforeCallbacks()));
        $event->start();
    }