]> git.mjollnir.org Git - moodle.git/commitdiff
Make debugging more helpful by printing a full stack trace.
authortjhunt <tjhunt>
Thu, 22 Mar 2007 16:43:48 +0000 (16:43 +0000)
committertjhunt <tjhunt>
Thu, 22 Mar 2007 16:43:48 +0000 (16:43 +0000)
lib/weblib.php

index 2e3451afbc32aedc5777a2296e0b9feeca263841..70ffc7280ab33731318802f9eae4d255b85ebbe8 100644 (file)
@@ -5756,12 +5756,20 @@ function debugging($message='', $level=DEBUG_NORMAL) {
 
     if ($CFG->debug >= $level) {
         if ($message) {
-            $caller = debug_backtrace();
-            $caller = $caller[0];
-            $from = " in $caller[file] on line $caller[line]";
-            if (isset($caller['function'])) {
-                $from .= " in $caller[function]()";
+            $callers = debug_backtrace();
+            $from = '<ul style="text-align: left">';
+            foreach ($callers as $caller) {
+                $from .= '<li>line ' . $caller['line'] . ' of ' . substr($caller['file'], strlen($CFG->dirroot) + 1);
+                if (isset($caller['function'])) {
+                    $from .= ': call to ';
+                    if (isset($caller['class'])) {
+                        $from .= $caller['class'] . $caller['type'];
+                    }
+                    $from .= $caller['function'] . '()';
+                }
+                $from .= '</li>';
             }
+            $from .= '</ul>';
             if (!isset($CFG->debugdisplay)) {
                 $CFG->debugdisplay = ini_get('display_errors');
             }