Fix detection of logging place if called through Horde_Log_Logger#__call().
authorJan Schneider <jan@horde.org>
Wed, 24 Mar 2010 18:09:39 +0000 (19:09 +0100)
committerJan Schneider <jan@horde.org>
Wed, 24 Mar 2010 18:09:39 +0000 (19:09 +0100)
framework/Core/lib/Horde/Core/Log/Logger.php

index 8aab63e..e7fc57c 100644 (file)
@@ -72,7 +72,16 @@ class Horde_Core_Log_Logger extends Horde_Log_Logger
             }
 
             $trace = debug_backtrace();
-            $trace = $trace[isset($options['trace']) ? ($options['trace'] - 1) : 0];
+            if (isset($options['trace'])) {
+                $frame = $options['trace'] - 1;
+            } elseif (count($trace) > 1 &&
+                      $trace[1]['class'] == 'Horde_Log_Logger' &&
+                      $trace[1]['function'] == '__call') {
+                $frame = 2;
+            } else {
+                $frame = 0;
+            }
+            $trace = $trace[$frame];
         }
 
         $file = isset($options['file'])