public function outputEntriesSince($log, $start) { $cf = TransactionLog::cf(); while (true) { $keys = []; $lines = $cf->getSlice($log, $start); if ($lines) { foreach ($lines as $line => $type) { $keys[] = LogEntry::makeId($log, $line); $start = $line; } $entries = LogEntry::cf()->multiGetSlice($keys); if ($entries) { foreach ($entries as $transtime => $entry) { list(, $time) = explode('-', $transtime); $this->outputLine($time, $entry); } } if (count($lines) < 100) { break; } } else { break; } } }
public function execute() { try { $cf = TransactionLog::cf(); $entries = $cf->getSlice($this->_log, '', '', true, $this->_lines); if ($entries) { $since = last_key($entries); $this->outputEntriesSince($this->_log, $since); } else { echo "No data found\n"; } } catch (\Exception $e) { if ($e->getCode() == 404) { echo "No log exists"; } throw $e; } }