make sure that the formatter can be specified in the constructor
authorChuck Hagenbuch <chuck@horde.org>
Fri, 29 May 2009 03:28:03 +0000 (23:28 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Fri, 29 May 2009 03:28:10 +0000 (23:28 -0400)
framework/Log/lib/Horde/Log/Handler/Firebug.php
framework/Log/lib/Horde/Log/Handler/Stream.php

index f209eb8..077d92b 100644 (file)
@@ -57,10 +57,15 @@ class Horde_Log_Handler_Firebug extends Horde_Log_Handler_Base
 
     /**
      * Class Constructor
+     *
+     * @param Horde_Log_Formatter_Interface $formatter  Log formatter
      */
-    public function __construct()
+    public function __construct($formatter = null)
     {
-        $this->_formatter = new Horde_Log_Formatter_Simple();
+        if (is_null($formatter)) {
+            $formatter = new Horde_Log_Formatter_Simple();
+        }
+        $this->_formatter = $formatter;
     }
 
     /**
index bea99a8..6302be0 100644 (file)
@@ -41,10 +41,14 @@ class Horde_Log_Handler_Stream extends Horde_Log_Handler_Base
      *
      * @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+')
+    public function __construct($streamOrUrl, $mode = 'a+', $formatter = null)
     {
-        $this->_formatter = new Horde_Log_Formatter_Simple();
+        if (is_null($formatter)) {
+            $formatter = new Horde_Log_Formatter_Simple();
+        }
+        $this->_formatter = $formatter;
 
         if (is_resource($streamOrUrl)) {
             if (get_resource_type($streamOrUrl) != 'stream') {