]> git.mjollnir.org Git - moodle.git/commitdiff
debugging() - tell us who/where/when called us, like trigger_error() does
authormartinlanghoff <martinlanghoff>
Mon, 22 Jan 2007 01:55:09 +0000 (01:55 +0000)
committermartinlanghoff <martinlanghoff>
Mon, 22 Jan 2007 01:55:09 +0000 (01:55 +0000)
lib/weblib.php

index 24b6c2da6a70cf152321b6955fc1f3dc60e09922..6aaa10b93e00eaea5f2bc849a6abfbafd7e9cf51 100644 (file)
@@ -5529,13 +5529,19 @@ 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]()";
+            }
             if (!isset($CFG->debugdisplay)) {
                 $CFG->debugdisplay = ini_get('display_errors');
             }
             if ($CFG->debugdisplay) {
-                notify($message, 'notifytiny');
+                notify($message . $from, 'notifytiny');
             } else {
-                trigger_error($message, E_USER_NOTICE);
+                trigger_error($message . $from, E_USER_NOTICE);
             }
         }
         return true;