Processes a log record.

@param Record $record A record to process
191675
public function processRecord(Record $record)
    {

        $backtrace = debug_backtrace();
        $backtrace = $backtrace[5];

        $extraData = $record->getExtra();

        $extraData['file'] = $backtrace['file'];
        $extraData['line'] = $backtrace['line'];

        $record->setExtra($extraData);
    }
1003896
protected function write(array $record)
    {
        if ($record['level'] < Logger::NOTICE) {
            $this->handleDebugRecord($record);
        } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) {
            $this->handleExceptionRecord($record);
        } else {
            $this->handleErrorRecord($record);
        }
    }
1370393
public function addRecord(Record $l)
    {
        if ($this->collRecords === null) {
            $this->initRecords();
            $this->collRecordsPartial = true;
        }

        if (!$this->collRecords->contains($l)) {
            $this->doAddRecord($l);

            if ($this->recordsScheduledForDeletion and $this->recordsScheduledForDeletion->contains($l)) {
                $this->recordsScheduledForDeletion->remove($this->recordsScheduledForDeletion->search($l));
            }
        }

        return $this;
    }
743168
protected function processRecord(array $record): array
    {
        if ($this->processors) {
            foreach ($this->processors as $processor) {
                $record = PhpHelper::call($processor, $record);
            }
        }

        return $record;
    }
1228958
public function handle( IRecord $record )
    {
        // check if we should be logging this record
        if ( $record->getLevel() >= $this->_level )
        {
            $this->_mailer->isHtml( TRUE );
            $this->_mailer->setSubject( $record->getTitle() );

            $content = $this->getFormatter()->format( $record );

            $this->_mailer->setBody( $content );

            $this->_mailer->send();
        }
    }
1327736
public function process(EventRecord $eventRecord): void
    {
        $this->eventStore->append($eventRecord);
        $this->eventDispatcher->dispatch($eventRecord->eventMessage());
    }
37218
public function add(string $name, Record $record): void
    {
        $this->validateIdFormat($name);
        $this->preventOverwrite($name);
        $this->records[$name] = $record;
    }
465422
protected function write(array $record): void
    {
        if (!$this->isWebRequest()) {
            return;
        }

        self::$json['rows'][] = $record['formatted'];

        $this->send();
    }
1122206
protected function write(array $record)
    {
        if (!$this->initialized) {
            $this->initialize();
        }

        /**
         * reset $fields with default values
         */
        $this->fields = $this->defaultfields;

        /*
         * merge $record['context'] and $record['extra'] as additional info of Processors
         * getting added to $record['extra']
         * @see https://github.com/Seldaek/monolog/blob/master/doc/02-handlers-formatters-processors.md
         */
        if (isset($record['extra'])) {
            $record['context'] = array_merge($record['context'], $record['extra']);
        }

        //'context' contains the array
        $contentArray = array_merge(array(
                                        'channel' => $record['channel'],
                                        'level' => $record['level'],
                                        'message' => $record['message'],
                                        'time' => $record['datetime']->format('U')
                                    ), $record['context']);

        // unset array keys that are passed put not defined to be stored, to prevent sql errors
        foreach($contentArray as $key => $context) {
            if (! in_array($key, $this->fields)) {
                unset($contentArray[$key]);
                unset($this->fields[array_search($key, $this->fields)]);
                continue;
            }

            if ($context === null) {
                unset($contentArray[$key]);
                unset($this->fields[array_search($key, $this->fields)]);
            }
        }

        $this->prepareStatement();

        //Fill content array with "null" values if not provided
        $contentArray = $contentArray + array_combine(
            $this->additionalFields,
            array_fill(0, count($this->additionalFields), null)
        );

        $this->statement->execute($contentArray);
    }
1081342
protected function set_rules($record) {
        $comp = $record->createdcomp;
        if ($record->ruletype) {
            $class = $record->ruletype;
            if (class_exists($class)) {
                $oldruleconfig = $record->ruleconfig;
                if ($oldruleconfig == "null") {
                    $oldruleconfig = null;
                }
                $newruleconfig = $class::migrate_config($oldruleconfig, $this->mappings);
                $comp->set('ruleconfig', $newruleconfig);
                $comp->set('ruletype', $class);
                $comp->set('ruleoutcome', $record->ruleoutcome);
                $comp->update();
            }
        }
        foreach ($record->children as $child) {
            $this->set_rules($child);
        }
    }
1261835
public function handle(Collection $record)
    {
        $stringMessage = $this->formatter->format($record) . PHP_EOL;
        
        return (boolean) $this->writeStream($stringMessage);
    }
124134
protected function write( array $record )
    {
        if ($this->_debugbar->hasCollector('log') && $this->_debugbar->shouldCollect('log') ) {
            $type = array_keys( $this->_levelMap,$record['level_name']);
            $this->_debugbar->getCollector('log')
                ->add( $record['message'], end($type), microtime(true), $record['context']);
        }
    }
114797
@Override
	public void log(LogRecord record) {
		record.setMessage(maskPassword(record.getMessage()));
		super.log(record);
	}
1333359
public static function scheduled_task_from_record($record) {
        $classname = self::get_canonical_class_name($record->classname);
        if (!class_exists($classname)) {
            debugging("Failed to load task: " . $classname, DEBUG_DEVELOPER);
            return false;
        }
        /** @var \core\task\scheduled_task $task */
        $task = new $classname;
        if (isset($record->lastruntime)) {
            $task->set_last_run_time($record->lastruntime);
        }
        if (isset($record->nextruntime)) {
            $task->set_next_run_time($record->nextruntime);
        }
        if (isset($record->customised)) {
            $task->set_customised($record->customised);
        }
        if (isset($record->component)) {
            $task->set_component($record->component);
        }
        $task->set_blocking(!empty($record->blocking));
        if (isset($record->minute)) {
            $task->set_minute($record->minute);
        }
        if (isset($record->hour)) {
            $task->set_hour($record->hour);
        }
        if (isset($record->day)) {
            $task->set_day($record->day);
        }
        if (isset($record->month)) {
            $task->set_month($record->month);
        }
        if (isset($record->dayofweek)) {
            $task->set_day_of_week($record->dayofweek);
        }
        if (isset($record->faildelay)) {
            $task->set_fail_delay($record->faildelay);
        }
        if (isset($record->disabled)) {
            $task->set_disabled($record->disabled);
        }

        return $task;
    }
893920
protected function processRecord($record, $columnMap, &$results, $preview = false)
    {
        if (!is_array($record) || empty($record) || !array_filter($record)) {
            $results->addSkipped("Empty/invalid record data.");
            return;
        }
        //map incoming record according to the standardisation mapping (columnMap)
        $record = $this->columnMapRecord($record);
        //skip if required data is not present
        if (!$this->hasRequiredData($record)) {
            $results->addSkipped("Required data is missing.");
            return;
        }
        $modelClass = $this->objectClass;
        $placeholder = new $modelClass();

        //populate placeholder object with transformed data
        foreach ($this->mappableFields_cache as $field => $label) {
            //skip empty fields
            if (!isset($record[$field]) || empty($record[$field])) {
                continue;
            }
            $this->transformField($placeholder, $field, $record[$field]);
        }
        //find existing duplicate of placeholder data
        $obj = null;
        $existing = null;
        if (!$placeholder->ID && !empty($this->duplicateChecks)) {
            $data = $placeholder->getQueriedDatabaseFields();
            //don't match on ID, ClassName or RecordClassName
            unset($data['ID'], $data['ClassName'], $data['RecordClassName']);
            $existing = $this->findExistingObject($data);
        }
        if ($existing) {
            $obj = $existing;
            $obj->update($data);
        } else {
            // new record
            if (!$this->addNewRecords) {
                $results->addSkipped('New record not added');
                return;
            }
            $obj = $placeholder;
        }

        //callback access to every object
        if (is_callable($this->recordCallback)) {
            $callback  = $this->recordCallback;
            $callback($obj, $record);
        }

        $changed = $existing && $obj->isChanged();
        //try/catch for potential write() ValidationException
        try {
            // write obj record
            $obj->write();

            //publish pages
            if ($this->publishPages && $obj instanceof SiteTree) {
                $obj->publish('Stage', 'Live');
            }

            // save to results
            if ($existing) {
                if ($changed) {
                    $results->addUpdated($obj);
                } else {
                    $results->addSkipped("No data was changed.");
                }
            } else {
                $results->addCreated($obj);
            }
        } catch (ValidationException $e) {
            $results->addSkipped($e->getMessage());
        }

        $objID = $obj->ID;
        // reduce memory usage
        $obj->destroy();
        unset($existingObj);
        unset($obj);
        
        return $objID;
    }
54928
protected function getLogRecord($record)
    {
        $prefix = $suffix = array();

        // first infos
        $date = $record['datetime']->format( $this->datetime_format );
        $prefix[] = '['.$date.']';
        if (!empty($record['ip']))
            $prefix[] = '[ip '.$record['ip'].']';
        if (!empty($record['pid']))
            $prefix[] = '[pid '.$record['pid'].']';
        $prefix[] = $record['level_name'].' :';

        // last infos
        if (!empty($record['context'])) {
            $suffix[] = '['.$this->writeArray($record['context']).']';
        }
        if (!empty($record['extra'])) {
            $suffix[] = '['.$this->writeArray($record['extra']).']';
        }

        return join(' ', $prefix).' '.preg_replace("/\n*$/", ' ', $record['message']).' '.join(' ', $suffix);
    }
55096
public function processRecord(array $record)
    {
        $request = $this->requestStack->getCurrentRequest();

        $record['extra']['user_ip'] = '0.0.0.0';
        if (null !== $request) {
            $record['extra']['user_ip'] = $request->getClientIp();
            $record['extra']['user_name'] = $this->securityContext->getToken()->getUsername();
        }

        $record['extra']['site_name'] = $this->context->getSiteName();
        $record['extra']['site_id'] = $this->context->getSiteId();

        return $record;
    }