build = $build; // We want to add to any existing saved log information. $this->logValue = $build->getLog(); } /** * Destructor */ public function __destruct() { $this->flushData(); } /** * Flush buffered data */ protected function flushData() { $this->build->setLog($this->logValue); Factory::getStore('Build')->save($this->build); $this->flushTimestamp = time(); } /** * Write a log entry to the build log. * @param array $record */ protected function write(array $record) { $message = (string)$record['message']; $message = str_replace($this->build->getBuildPath(), './', $message); $this->logValue .= $message . PHP_EOL; if ($this->flushTimestamp < (time() - $this->flushDelay)) { $this->flushData(); } } }