summaryrefslogtreecommitdiff
path: root/it_debug.class
diff options
context:
space:
mode:
authorUrban Müller2007-11-29 18:41:17 +0000
committerUrban Müller2007-11-29 18:41:17 +0000
commit5d201ba6e58dee377303ae8f320c554cc0505c1b (patch)
treed81a2928c3f3e9df7d9777bed56fd37e5df287ca /it_debug.class
parente1b53693599a6ea6082bcdfac0517fb039372f08 (diff)
downloaditools-5d201ba6e58dee377303ae8f320c554cc0505c1b.tar.gz
itools-5d201ba6e58dee377303ae8f320c554cc0505c1b.tar.bz2
itools-5d201ba6e58dee377303ae8f320c554cc0505c1b.zip
allow skipping of library filenames
Diffstat (limited to 'it_debug.class')
-rw-r--r--it_debug.class16
1 files changed, 10 insertions, 6 deletions
diff --git a/it_debug.class b/it_debug.class
index 22f0d5a..0d0dd07 100644
--- a/it_debug.class
+++ b/it_debug.class
@@ -169,17 +169,21 @@ function dump($args)
/**
* Print short stackdump
- * @param $skip number of stack levels to omip
+ * @param $p['skiplevels'] number of stack levels to omit
+ * @param $p['skipfiles'] regular expression of filenames to omit
*/
-function backtrace($skip = 0)
+function backtrace($p = array())
{
- $result = array();
+ if (!is_array($p))
+ $p = array('skiplevels' => $p);
+
+ $p += array('skiplevels'=> 0, 'skipfiles' => "###");
if (!function_exists('memory_get_usage') || (memory_get_usage() < 50000000))
{
- foreach (array_slice(debug_backtrace(), $skip + 1) as $call)
+ foreach (array_slice(debug_backtrace(), $p['skiplevels'] + 1) as $call)
{
- if (($fn = $call['file']))
+ if (($fn = $call['file']) && !it::match($p['skipfiles'], $call['file']))
{
$fn = (it::match('auto_prepend', $fn) ? basename(dirname($fn)) . "/" : "") . basename($fn);
$result[] = $fn . ":" . $call['line'];
@@ -187,7 +191,7 @@ function backtrace($skip = 0)
}
}
- return join(" ", $result);
+ return join(" ", (array)$result);
}
}