Замена макросов в шаблоне лога на значения

@return LogRecord
353121
public function parse()
	{
		if ($this->record->context instanceof \Exception)
		{
			$this->record->formatted = str_replace("{short-exc}", print_r($this->record->context->getMessage(), 1), $this->record->formatted);
		}
		return $this->record;
	}
1050167
static public function log()
    {
        if (!self::$config->logger) {
            self::$config->logger = self::defaultLogger();
        } elseif (self::$config->logger instanceof \Closure) {
            $closure = self::$config->logger;
            self::$config->logger = $closure();
        }

        if (func_num_args()) {
            return self::$config->logger->vars(func_get_args());
        }

        return self::$config->logger;
    }
447912
public function to_record() {
        return (object) array(
            'id'            => $this->id,
            'tourid'        => $this->tourid,
            'title'         => $this->title,
            'content'       => $this->content,
            'targettype'    => $this->targettype,
            'targetvalue'   => $this->targetvalue,
            'sortorder'     => $this->sortorder,
            'configdata'    => json_encode($this->config),
        );
    }
1281942
public function toRecords()
    {
        $result = [];

        while ($chunk = $this->error->read(65535)) {
            $result[] = new Record(new Header(RecordType::stderr(), $this->requestId, strlen($chunk)), $chunk);
        }

        while ($chunk = $this->content->read(65535)) {
            $result[] = new Record(new Header(RecordType::stdout(), $this->requestId, strlen($chunk)), $chunk);
        }
        $result[] = new Record(new Header(RecordType::stdout(), $this->requestId, 0, 8), '');

        $result[] = new Record(new Header(RecordType::endRequest(), $this->requestId, 0, 8), '');

        return new ArrayIterator($result);
    }
434276
public function log()
    {
        if (is_null($this->log)) {
            $this->log = app(Log::class);
        }

        return $this->log;
    }
114506
protected function getRecords() {
        if (!$this->_records) {
            $this->_records = new RecordList($this->version, $this->solution['accountSid']);
        }

        return $this->_records;
    }
212604
public function getRecord()
    {
        if ($this->record) {
            return $this->record;
        }
        if (!$this->getForm()) {
            return null;
        }

        // Get record from form
        $record = $this->getForm()->getRecord();
        if ($record && ($record instanceof DataObject)) {
            $this->record = $record;
            return $record;
        }

        // Get record from controller
        $controller = $this->getForm()->getController();
        if ($controller
            && $controller->hasMethod('data')
            && ($record = $controller->data())
            && ($record instanceof DataObject)
        ) {
            $this->record = $record;
            return $record;
        }

        return null;
    }
81837
public function logger()
    {
        if (is_null($this->logger)) {
            $this->logger = app(Logger::class);
        }

        return $this->logger;
    }
1330704
public function getLogsFromCurrentFile()
    {
        if ($this->currentFile === null) {
            return [];
        }

        if (File::size($this->currentFile) > $this->maxFileSize) {
            return;
        }

        $datePattern = '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}';
        $pattern = "/\\[$datePattern\\].*/";
        $fileContent = File::get($this->currentFile);

        preg_match_all($pattern, $fileContent, $rows);

        if (!is_array($rows) || count($rows) === 0) {
            return [];
        }

        $rows = $rows[0];
        $logs = [];

        foreach ($rows as $row) {
            preg_match(
                "/^\\[($datePattern)\\].*?(\\w+)\\."
                . '([A-Z]+): (.*?)( in .*?:[0-9]+)?$/',
                $row,
                $matches
            );

            if (!isset($matches[4])) {
                continue;
            }

            $level = Str::lower($matches[3]);

            $inFile = null;
            if (isset($matches[5])) {
                $inFile = substr($matches[5], 4);
            }

            $logs[] = (object) [
                'context' => $matches[2],
                'level' => $level,
                'levelClass' => static::$levelsClasses[$level],
                'levelImg' => static::$levelsImgs[$level],
                'date' => $matches[1],
                'text' => trim($matches[4]),
                'inFile' => $inFile,
            ];
        }

        return array_reverse($logs);
    }
1017139
public function getRecord() {
		$form = $this->getForm();
		if (!$this->record && $form) {
			if (($record = $form->getRecord()) && ($record instanceof DataObject)) {
				$this->record = $record;
			} elseif (($controller = $form->Controller())
				&& $controller->hasMethod('data')
				&& ($record = $controller->data())
				&& ($record instanceof DataObject)
			) {
				$this->setRecord($record);
			}
		}
		return $this->record;
	}
1005305
public function getEmptyRecord()
    {
        $data = [];
        if ($this->fields) foreach ($this->fields as $k => $v) {
            $data[$k] = '';
        }
        
        return static::formatOutput($data);
    }
72810
protected function get_legacy_logdata() {
        $grade = $this->get_record_snapshot('assign_grades', $this->objectid);
        $this->set_legacy_logdata('grade submission', $this->assign->format_grade_for_log($grade));
        return parent::get_legacy_logdata();
    }
748906
protected function getRecords()
    {
        $records = null;
        $model = $this->controller->reorderGetModel();
        $query = $model->newQuery();

        $this->controller->reorderExtendQuery($query);

        if ($this->sortMode == 'simple') {
            $records = $query
                ->orderBy($model->getSortOrderColumn())
                ->get()
            ;
        }
        elseif ($this->sortMode == 'nested') {
            $records = $query->getNested();
        }

        return $records;
    }
1362717
protected function get_parent_record() {
        global $DB;

        if (!isset($this->parentrecord)) {
            $this->parentrecord = $DB->get_record('event', ['id' => $this->parentid]);
        }

        return $this->parentrecord;
    }
356670
public function Form()
    {
        if ($this->currentRecord) {
            $fields = $this->currentRecord->getFrontEndFields();
            $required = $this->currentRecord->getRequiredFields();
        } else {
            $fields = singleton($this->recordType)->getFrontEndFields();
            $required = singleton($this->recordType)->getFrontEndFields();
        }

        $fields->push(new HiddenField('ID'));
        $form = new Form($this, __function__, $fields, new FieldList(new FormAction('doSave', 'Save')), $required);
        if ($this->currentRecord) {
            $form->loadDataFrom($this->currentRecord);
        }
        return $form;
    }
358105
public function getLogDir()
    {
        static $dir;
        if (empty($dir)) {
            $dir = $this->getOpenDir() . '/log/';

            if (!is_dir($dir)) {
                mkdir($dir, 0755, true);
            }
        }
        return $dir;
    }
1369366
protected function getRecords()
    {
        $records = [];

        foreach ($this->query->get() as $row) {
            $record = [];
            foreach ($this->columns as $name => $handler) {
                $record[$name] = $handler($row);
            }
            $records[] = $record;
        }

        return $records;
    }