yii\elasticsearch\ElasticsearchTarget::collect PHP Метод

collect() публичный Метод

This method will filter the given messages with [[levels]] and [[categories]]. And if requested, it will also export the filtering result to specific medium (e.g. email). Depending on the [[includeContext]] attribute, a context message will be either created or ignored.
public collect ( array $messages, boolean $final )
$messages array log messages to be processed. See [[Logger::messages]] for the structure of each message.
$final boolean whether this method is called at the end of the current application
    public function collect($messages, $final)
    {
        $this->messages = array_merge($this->messages, static::filterMessages($messages, $this->getLevels(), $this->categories, $this->except));
        $count = count($this->messages);
        if ($count > 0 && ($final || $this->exportInterval > 0 && $count >= $this->exportInterval)) {
            if (!$this->includeContext && $this->logContext) {
                $context = $this->getContextMessage();
                if (!empty($context)) {
                    $this->messages[] = [$context, Logger::LEVEL_INFO, 'application', YII_BEGIN_TIME];
                }
            }
            // set exportInterval to 0 to avoid triggering export again while exporting
            $oldExportInterval = $this->exportInterval;
            $this->exportInterval = 0;
            $this->export();
            $this->exportInterval = $oldExportInterval;
            $this->messages = [];
        }
    }