From 5b8ebd2770f430b618924b61dbccaea0bf14e478 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Sat, 29 May 2010 11:06:56 +0200 Subject: [PATCH] The formatters are implementing the formatter interface. --- framework/Log/lib/Horde/Log/Formatter/Simple.php | 2 +- framework/Log/lib/Horde/Log/Formatter/Xml.php | 2 +- framework/Log/lib/Horde/Log/Handler/Stream.php | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/framework/Log/lib/Horde/Log/Formatter/Simple.php b/framework/Log/lib/Horde/Log/Formatter/Simple.php index 7be521ce5..8b1963573 100644 --- a/framework/Log/lib/Horde/Log/Formatter/Simple.php +++ b/framework/Log/lib/Horde/Log/Formatter/Simple.php @@ -22,7 +22,7 @@ * @author Chuck Hagenbuch * @license http://opensource.org/licenses/bsd-license.php BSD */ -class Horde_Log_Formatter_Simple +class Horde_Log_Formatter_Simple implements Horde_Log_Formatter_Interface { /** * Format string diff --git a/framework/Log/lib/Horde/Log/Formatter/Xml.php b/framework/Log/lib/Horde/Log/Formatter/Xml.php index 9b3511942..b3ad9a311 100644 --- a/framework/Log/lib/Horde/Log/Formatter/Xml.php +++ b/framework/Log/lib/Horde/Log/Formatter/Xml.php @@ -22,7 +22,7 @@ * @author Chuck Hagenbuch * @license http://opensource.org/licenses/bsd-license.php BSD */ -class Horde_Log_Formatter_Xml +class Horde_Log_Formatter_Xml implements Horde_Log_Formatter_Interface { protected $_options = array('elementEntry' => 'log', 'elementTimestamp' => 'timestamp', diff --git a/framework/Log/lib/Horde/Log/Handler/Stream.php b/framework/Log/lib/Horde/Log/Handler/Stream.php index 5757d0dc6..dcb4d351b 100644 --- a/framework/Log/lib/Horde/Log/Handler/Stream.php +++ b/framework/Log/lib/Horde/Log/Handler/Stream.php @@ -53,11 +53,14 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base /** * Class Constructor * - * @param mixed $streamOrUrl Stream or URL to open as a stream - * @param string $mode Mode, only applicable if a URL is given - * @param Horde_Log_Formatter_Interface $formatter Log formatter + * @param mixed $streamOrUrl Stream or URL to open + * as a stream. + * @param string $mode Mode, only applicable + * if a URL is given. + * @param Horde_Log_Formatter_Interface $formatter Log formatter. */ - public function __construct($streamOrUrl, $mode = 'a+', $formatter = null) + public function __construct($streamOrUrl, $mode = 'a+', + Horde_Log_Formatter_Interface $formatter = null) { if (is_null($formatter)) { $formatter = new Horde_Log_Formatter_Simple(); @@ -87,7 +90,7 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base */ public function __wakeup() { - if (! $this->_stream = @fopen($this->_streamOrUrl, $this->_mode, false)) { + if (!($this->_stream = @fopen($this->_streamOrUrl, $this->_mode, false))) { $msg = '"' . $this->_streamOrUrl . '" cannot be opened with mode "' . $this->_mode . '"'; throw new Horde_Log_Exception($msg); } @@ -103,7 +106,7 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base { $line = $this->_formatter->format($event); - if (! @fwrite($this->_stream, $line)) { + if (!@fwrite($this->_stream, $line)) { throw new Horde_Log_Exception("Unable to write to stream"); } -- 2.11.0