From a4a808da9446fd1d5ef4a35095df6e045794aaf8 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 26 Mar 2010 19:54:55 -0600 Subject: [PATCH] Bug #8937: Convert priority to integer; don't exit prematurely --- framework/Core/lib/Horde/Core/Log/Logger.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/framework/Core/lib/Horde/Core/Log/Logger.php b/framework/Core/lib/Horde/Core/Log/Logger.php index e7fc57cc7..1720d14b1 100644 --- a/framework/Core/lib/Horde/Core/Log/Logger.php +++ b/framework/Core/lib/Horde/Core/Log/Logger.php @@ -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); -- 2.11.0