mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Make debugging more helpful by printing a full stack trace.
This commit is contained in:
parent
cb6a4f09ee
commit
6fd3300925
1 changed files with 13 additions and 5 deletions
|
@ -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]";
|
||||
$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 .= " in $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');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue