Bug #8937: Convert priority to integer; don't exit prematurely
authorMichael M Slusarz <slusarz@curecanti.org>
Sat, 27 Mar 2010 01:54:55 +0000 (19:54 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sat, 27 Mar 2010 01:54:55 +0000 (19:54 -0600)
framework/Core/lib/Horde/Core/Log/Logger.php

index e7fc57c..1720d14 100644 (file)
@@ -19,9 +19,9 @@ class Horde_Core_Log_Logger extends Horde_Log_Logger
      *
      * @param mixed $event     Either a string (log string), an array
      *                         (containing 'level', 'message', and 'timestamp'
-                               entries) or an object with a getMessage()
-                               method (e.g. PEAR_Error, Exception,
-                               ErrorException).
+     *                         entries) or an object with a getMessage()
+     *                         method (e.g. PEAR_Error, Exception,
+     *                         ErrorException).
      * @param mixed $priority  The priority of the message. Integers
      *                         correspond to Horde_Log constants. String
      *                         values are auto translated to Horde_Log
@@ -35,11 +35,17 @@ class Horde_Core_Log_Logger extends Horde_Log_Logger
      */
     public function log($event, $priority = 'INFO', $options = array())
     {
+        if (is_string($priority)) {
+            $priority = defined('Horde_Log::' . $priority)
+                ? constant('Horde_Log::' . $priority)
+                : Horde_Log::INFO;
+        }
+
         /* If an array is passed in, assume that the caller knew what they
          * were doing and pass it directly to the log backend. */
         if (is_array($event)) {
             parent::log($event, $priority);
-            exit;
+            return;
         }
 
         if ($event instanceof Exception) {
@@ -100,12 +106,6 @@ class Horde_Core_Log_Logger extends Horde_Log_Logger
             $text .
             ' [pid ' . getmypid() . ' on line ' . $line . ' of "' . $file . '"]';
 
-        if (is_string($priority)) {
-            $priority = defined('Horde_Log::' . $priority)
-                ? constant('Horde_Log::' . $priority)
-                : Horde_Log::INFO;
-        }
-
         /* Make sure to log in the system's locale and timezone. */
         // TODO: Needed?
         $locale = setlocale(LC_TIME, 0);