Mercurial > projects > dwt-win
changeset 202:1d129e5f6aa6
extend PrintStackTrace
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 12 Apr 2008 17:50:15 +0200 |
parents | 6293c40673a4 |
children | 8313535d74fa |
files | dwt/dwthelper/utils.d |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/dwt/dwthelper/utils.d Fri Apr 11 23:22:24 2008 +0200 +++ b/dwt/dwthelper/utils.d Sat Apr 12 17:50:15 2008 +0200 @@ -929,14 +929,15 @@ return res; } -void PrintStackTrace(){ - try{ - throw new Exception( null ); - } - catch( Exception e ){ - foreach( msg; e.info ){ - Trace.formatln( "trc: {}", msg ); +void PrintStackTrace( int deepth = 100, char[] prefix = "trc" ){ + auto e = new Exception( null ); + int idx = 0; + const start = 3; + foreach( msg; e.info ){ + if( idx >= start && idx < start+deepth ) { + Trace.formatln( "{}: {}", prefix, msg ); } + idx++; } }