From: martinlanghoff Date: Mon, 22 Jan 2007 01:55:09 +0000 (+0000) Subject: debugging() - tell us who/where/when called us, like trigger_error() does X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1a5d0b7f54cf8bab9a1984770c14e33c5c65343c;p=moodle.git debugging() - tell us who/where/when called us, like trigger_error() does --- diff --git a/lib/weblib.php b/lib/weblib.php index 24b6c2da6a..6aaa10b93e 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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;