Index: tests/Zend/Log/LogTest.php =================================================================== --- tests/Zend/Log/LogTest.php (revision 21105) +++ tests/Zend/Log/LogTest.php (working copy) @@ -287,4 +287,26 @@ $logger = Zend_Log::factory($cfg['log']); $this->assertTrue($logger instanceof Zend_Log); } + + /** + * @group ZF-8953 + */ + public function testFluentInterface() + { + $options = array( + 'writer' => array( + 'writerName' => 'Null', + ), + 'filter' => array( + 'filterName' => 'Priority', + ) + ); + $log = new Zend_Log(); + $l = $log->addWriter($options['writer']) + ->addFilter($options['filter']) + ->addPriority('foo' , 10) + ->setEventItem('message', 'Test Fluent Interface'); + + $this->assertTrue($l instanceof Zend_Log); + } } Index: library/Zend/Log.php =================================================================== --- library/Zend/Log.php (revision 21105) +++ library/Zend/Log.php (working copy) @@ -344,6 +344,7 @@ * @param string $name Name of priority * @param integer $priority Numeric priority * @throws Zend_Log_InvalidArgumentException + * @return Zend_Log */ public function addPriority($name, $priority) { @@ -358,6 +359,7 @@ } $this->_priorities[$priority] = $name; + return $this; } /** @@ -366,7 +368,7 @@ * must be accepted by all filters added with this method. * * @param int|Zend_Log_Filter_Interface $filter - * @return void + * @return Zend_Log */ public function addFilter($filter) { @@ -385,6 +387,7 @@ } $this->_filters[] = $filter; + return $this; } /** @@ -392,7 +395,7 @@ * message and writing it out to storage. * * @param mixed $writer Zend_Log_Writer_Abstract or Config array - * @return void + * @return Zend_Log */ public function addWriter($writer) { @@ -410,6 +413,7 @@ } $this->_writers[] = $writer; + return $this; } /** @@ -417,9 +421,11 @@ * * @param $name Name of the field * @param $value Value of the field - * @return void + * @return Zend_Log */ - public function setEventItem($name, $value) { + public function setEventItem($name, $value) + { $this->_extras = array_merge($this->_extras, array($name => $value)); + return $this; } }