summaryrefslogtreecommitdiff
path: root/it_debug.class
diff options
context:
space:
mode:
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;
}
}
}