summaryrefslogtreecommitdiff
path: root/it_debug.class
diff options
context:
space:
mode:
authorChristian Schneider2007-11-30 14:48:14 +0000
committerChristian Schneider2007-11-30 14:48:14 +0000
commitd2af852a6255a9732dec24066d5e16db07252363 (patch)
tree6336b6fd1966343c2fd41cad120970f9da7adf18 /it_debug.class
parent9f66343f9713a5d10bf3a59f59295d09bde528c3 (diff)
downloaditools-d2af852a6255a9732dec24066d5e16db07252363.tar.gz
itools-d2af852a6255a9732dec24066d5e16db07252363.tar.bz2
itools-d2af852a6255a9732dec24066d5e16db07252363.zip
Allow truncation of backtrace
Diffstat (limited to 'it_debug.class')
-rw-r--r--it_debug.class8
1 files changed, 6 insertions, 2 deletions
diff --git a/it_debug.class b/it_debug.class
index 0d0dd07..8b3fd2a 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -168,7 +168,8 @@ function dump($args)
}
/**
- * Print short stackdump
+ * Return short stackdump
+ * @param $p['levels'] number of stack levels to return (default: 0 = all)
* @param $p['skiplevels'] number of stack levels to omit
* @param $p['skipfiles'] regular expression of filenames to omit
*/
@@ -177,7 +178,7 @@ function backtrace($p = array())
if (!is_array($p))
$p = array('skiplevels' => $p);
- $p += array('skiplevels'=> 0, 'skipfiles' => "###");
+ $p += array('levels' => 0, 'skiplevels'=> 0, 'skipfiles' => "###");
if (!function_exists('memory_get_usage') || (memory_get_usage() < 50000000))
{
@@ -187,6 +188,9 @@ function backtrace($p = array())
{
$fn = (it::match('auto_prepend', $fn) ? basename(dirname($fn)) . "/" : "") . basename($fn);
$result[] = $fn . ":" . $call['line'];
+
+ if (--$p['levels'] == 0)
+ break;
}
}
}