code: public function collect($messages, $final)
      {
          $this->messages = array_merge($this->messages, $this->filterMessages($messages, $this->getLevels(), $this->categories, $this->except));
          $count = count($this->messages);
          if ($count > 0 && ($final || $this->exportInterval > 0 && $count >= $this->exportInterval)) {
              $this->export();
              $this->messages = [];
          }
      }
docs: Processes the given log messages.
  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).
  @param array $messages log messages to be processed. See [[Logger::messages]] for the structure
  of each message.
  @param boolean $final whether this method is called at the end of the current application