The formatters are implementing the formatter interface.
authorJan Schneider <jan@horde.org>
Sat, 29 May 2010 09:06:56 +0000 (11:06 +0200)
committerJan Schneider <jan@horde.org>
Sat, 29 May 2010 09:06:56 +0000 (11:06 +0200)
framework/Log/lib/Horde/Log/Formatter/Simple.php
framework/Log/lib/Horde/Log/Formatter/Xml.php
framework/Log/lib/Horde/Log/Handler/Stream.php

index 7be521c..8b19635 100644 (file)
@@ -22,7 +22,7 @@
  * @author   Chuck Hagenbuch <chuck@horde.org>
  * @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
index 9b35119..b3ad9a3 100644 (file)
@@ -22,7 +22,7 @@
  * @author   Chuck Hagenbuch <chuck@horde.org>
  * @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',
index 5757d0d..dcb4d35 100644 (file)
@@ -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");
         }