Added stack tracing to each model::pr print

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@473 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-03 18:38:35 +00:00
parent 7fda78f820
commit df91125e96

View File

@@ -114,7 +114,7 @@ class AppModel extends Model {
$line = $caller['line']; $line = $caller['line'];
// So, this caller holds the calling function name // So, this caller holds the calling function name
$caller = array_shift($trace); $caller = $trace[0];
$function = $caller['function']; $function = $caller['function'];
$class = $caller['class']; $class = $caller['class'];
//$class = $this->name; //$class = $this->name;
@@ -141,13 +141,39 @@ class AppModel extends Model {
$mixed = $chk + array($mixed); $mixed = $chk + array($mixed);
} }
echo '<DIV CLASS="pr-caller">'; static $pr_unique_number = 0;
echo '<strong>' . substr(str_replace(ROOT, '', $file), 1) . '</strong>'; $pr_id = $class . '-' . (++$pr_unique_number);
echo ' (line <strong>' . $line . '</strong>)'; $trace = array_reverse($trace);
echo ' : level-' . $level;
echo '<DIV CLASS="pr-caller">'."\n";
echo '<DIV id="'.$pr_id.'" style="display:none;">'."\n";
for ($i = 0; $i < count($trace); ++$i) {
$bline = $trace[$i]['line'];
$bfile = $trace[$i]['file'];
$bfile = str_replace(ROOT.DS, '', $bfile);
$bfile = str_replace(CAKE_CORE_INCLUDE_PATH.DS, '', $bfile);
if ($i > 0) {
$bfunc = $trace[$i-1]['function'];
$bclas = $trace[$i-1]['class'];
} else {
$bfunc = null;
$bclas = null;
}
echo("$bfile:$bline (" . ($bclas ? "$bclas::$bfunc" : "entry point") . ")<BR>");
//echo(($bclas ? "$bclas::$bfunc" : "entry point") . "; $bfile : $bline<BR>");
}
echo '</DIV>' . "\n";
$file = str_replace(ROOT.DS, '', $file);
$file = str_replace(CAKE_CORE_INCLUDE_PATH.DS, '', $file);
echo '<strong>' . $file . '</strong>:<strong>' . $line . '</strong>'.";\n";
echo ' <A HREF="#" onclick="$' . "('#{$pr_id}').slideToggle(); return false;" . '">stack</A>'.";\n";
echo ' L' . $level . "\n";
echo '</DIV>' . "\n"; echo '</DIV>' . "\n";
pr(array("{$class}::{$function}()" => $mixed), false, false); pr(array("{$class}::{$function}" => $mixed), false, false);
} }
function pr($level, $mixed, $checkpoint = null) { function pr($level, $mixed, $checkpoint = null) {