diff options
author | Christian Schneider | 2007-11-30 14:48:14 +0000 |
---|---|---|
committer | Christian Schneider | 2007-11-30 14:48:14 +0000 |
commit | d2af852a6255a9732dec24066d5e16db07252363 (patch) | |
tree | 6336b6fd1966343c2fd41cad120970f9da7adf18 /it_debug.class | |
parent | 9f66343f9713a5d10bf3a59f59295d09bde528c3 (diff) | |
download | itools-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.class | 8 |
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; } } } |