From 7ae44d20d76eeed533705f348977f5ba6e73d50e Mon Sep 17 00:00:00 2001 From: Michael Meckelein Date: Wed, 12 Mar 2008 10:00:04 +0100 Subject: [PATCH] fixed: last line was not correctly handled in logstreamdisk --- classes/logstreamdisk.class.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/classes/logstreamdisk.class.php b/classes/logstreamdisk.class.php index aea44d2..d3465a2 100644 --- a/classes/logstreamdisk.class.php +++ b/classes/logstreamdisk.class.php @@ -153,20 +153,21 @@ class LogStreamDisk extends LogStream { $line = ''; do { + $arrProperitesOut[SYSLOG_DATE] = ''; + $arrProperitesOut[SYSLOG_FACILITY] = ''; + $arrProperitesOut[SYSLOG_FACILITY_TEXT] = ''; + $arrProperitesOut[SYSLOG_SEVERITY] = ''; + $arrProperitesOut[SYSLOG_SEVERITY_TEXT] = ''; + $arrProperitesOut[SYSLOG_HOST] = ''; + $arrProperitesOut[SYSLOG_SYSLOGTAG] = ''; + $arrProperitesOut[SYSLOG_MESSAGE] = ''; + $arrProperitesOut[SYSLOG_MESSAGETYPE] = ''; $pos = -1; if (($pos = strpos($this->_buffer, "\n", $this->_p_buffer)) !== false) { $uID = $this->_currentStartPos; $logLine = $line . substr($this->_buffer, $this->_p_buffer, $pos - $this->_p_buffer); - $arrProperitesOut[SYSLOG_DATE] = ''; - $arrProperitesOut[SYSLOG_FACILITY] = ''; - $arrProperitesOut[SYSLOG_FACILITY_TEXT] = ''; - $arrProperitesOut[SYSLOG_SEVERITY] = ''; - $arrProperitesOut[SYSLOG_SEVERITY_TEXT] = ''; - $arrProperitesOut[SYSLOG_HOST] = ''; - $arrProperitesOut[SYSLOG_SYSLOGTAG] = ''; $arrProperitesOut[SYSLOG_MESSAGE] = $logLine; - $arrProperitesOut[SYSLOG_MESSAGETYPE] = ''; $this->_currentOffset = $pos - $this->_p_buffer + 1; $this->_p_buffer = $pos + 1; @@ -178,15 +179,13 @@ class LogStreamDisk extends LogStream { $this->_currentOffset += $this->_buffer_length - $this->_p_buffer; } while ($this->ReadNextBlock() == SUCCESS); - /* ToDo: Last enty is not yet handled - if ($this->_p_buffer < $this->_buffer_length - 1) { + if ($line != '') { $uID = $this->_currentStartPos; - $logLine = $line . substr($this->_buffer, $this->_p_buffer, $pos - $this->_p_buffer); + $arrProperitesOut[SYSLOG_MESSAGE] = $line; - $this->_currentOffset = $pos - $this->_p_buffer + 1; - $this->_p_buffer = $pos + 1; $this->_currentStartPos = $this->_currentOffset; - }*/ + return SUCCESS; + } return ERROR_UNDEFINED; }