File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ class PrettyPrinter extends LogPrinter {
63
63
64
64
static DateTime ? _startTime;
65
65
66
+ /// The index which to begin the stack trace at
67
+ ///
68
+ /// This can be useful if, for instance, Logger is wrapped in another class and
69
+ /// you wish to remove these wrapped calls from stack trace
70
+ final int stackTraceBeginIndex;
66
71
final int methodCount;
67
72
final int errorMethodCount;
68
73
final int lineLength;
@@ -75,6 +80,7 @@ class PrettyPrinter extends LogPrinter {
75
80
String _bottomBorder = '' ;
76
81
77
82
PrettyPrinter ({
83
+ this .stackTraceBeginIndex = 0 ,
78
84
this .methodCount = 2 ,
79
85
this .errorMethodCount = 8 ,
80
86
this .lineLength = 120 ,
@@ -127,6 +133,9 @@ class PrettyPrinter extends LogPrinter {
127
133
128
134
String ? formatStackTrace (StackTrace ? stackTrace, int methodCount) {
129
135
var lines = stackTrace.toString ().split ('\n ' );
136
+ if (stackTraceBeginIndex > 0 ) {
137
+ lines = lines.sublist (stackTraceBeginIndex);
138
+ }
130
139
var formatted = < String > [];
131
140
var count = 0 ;
132
141
for (var line in lines) {
You can’t perform that action at this time.
0 commit comments